Classes with Static Methods
- You can have a class inside another class, you cannot have a namespace inside the class (because it probably doesn't make any sense).
- They work with very ancient compilers.
Namespaces
- you can create namespace aliases
namespace io = boost::iostreams; Well, you can typedef classes, so that's a moot point.
You can import characters into other namespaces.
namespace mystuff { using namespace boost; }
You can import selected characters.
using std::string;
they can span multiple files (a very important advantage)
built-in namespaces (C ++ 11)
Bottom line: namespaces are a way to migrate to C ++.
source share