Reputation: 24760
I am building a library that consists of many different classes and files but they are all related so I am thinking that putting them in the same namespace is a good idea; this also allows me to use less risky generic/simple class names since name collision inside the namespace is not an issue.
Is the process of using the same namespace for many different files as simple as simply putting all the classes inside the same-named namespace?
ClassA.h, ClassB.h, ClassC.h, etc contain this:
namespace Whatever{
...Class definition
}
Upvotes: 2
Views: 2384
Reputation: 1675
Yes you can surely move ahead with this idea. If we use same namespace name in different files those get automatically clubbed into one.
Upvotes: 1
Reputation: 24760
As per the comment by Joachim Pileborg, this is acceptable organizational style, and is in fact used by the STL itself.
Upvotes: 1