I notice that C++'s std
namespace is spread across several files (like in vector
, string
, iostream
, etc.). How can I accomplish the same thing in my programs? Do I simply declare the same namespace in each individual header file, so that it's something like:
a.h
namespace something
{
class A {};
}
b.h
#include "a.h"
namespace something
{
class B : public A {};
}
And then in, say, main.cpp
, I would just include "b.h" and "a.h" and then using namespace something;
to use the two classes?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…