[Solved] What’s the difference between namespaces & classes? [closed]


There are plenty of differences. A namespace is a grouping mechanism for names, nothing more or less. On the other hand, classes:

  • Are types.
  • Can be instantiated.
  • Can be derived from.
  • Can have public, protected, and private members.
  • Can have virtual functions.

And so on.

If you find yourself wondering whether you should use a namespace or a class, then you are probably just looking for a way to control the scope of names—so the choice is clear: use a namespace.

0

solved What’s the difference between namespaces & classes? [closed]