In the example below, is it necessary to use namespace A{} in the source file or is it redundant as it is already been done in the header file?
// header file Foo.h
namespace A
{
class Foo
{
Foo();
};
}
// source file Foo.cpp
#include "Foo.h"
namespace A
{
Foo::Foo() {}
}
It's necessary, but you can do the following instead:
// source file Foo.cpp
#include "Foo.h"
A::Foo::Foo() {}
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