Namespaces in large programs

I'm having some issues with namespaces in large programs. My namespace looks like

namespace myspace {
class A;
class B;
class C;
class D;
}

#include A.h;
#include B.h;
#include C.h;
#include D.h;

Where any one of the classes my have templates. In the *.h and *.cpp files, do I need a

namespace myspace {} ?

What header file do I put in the classes in the namespace?

Thanks
Put the entire class definition and all template code inside the namespace(in the header), then put the whole of the cpp code inside namespace as well (in the cpp file).

I wouldn't bother with forward declaring the classes.

Edit:

Make sure you have separate files for each class.
Last edited on
Topic archived. No new replies allowed.