I am new to C++ and I want to know what is better/cleaner?
e.g:
//foo.h
namespace foo
{
    void bar();
}
1.)
//foo.cpp
namespace foo
{
    void bar()
    {
        //do something
    }
}
or 2.)
//foo.cpp
void foo::bar()
{
    //do something
}
                There is no difference what-so-ever to the resulting compiled code. It is purely a matter of style.
Use what you like the most (or what is currently the style-in-use of the code base you are working on).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With