Should the include guards be unique even between namespaces?

Posted by Arun on Stack Overflow See other posts from Stack Overflow or by Arun
Published on 2011-03-04T07:17:46Z Indexed on 2011/03/04 7:25 UTC
Read the original article Hit count: 186

Filed under:
|
|
|

I am using same class name in two namespaces, say A and B. Should the include guards be unique while declaring the classes with different namespaces too?

I mean can't there be two files names AFile.h (in different directories) with same include guards and declaring different namespaces?

File 1:

#ifndef AFILE_H

#define AFILE_H

namespace A {

class CAFile

{...

};

};

#endif

File 2:

#ifndef AFILE_H

#define AFILE_H

namespace B {

class CAFile

{...

};

};

#endif

© Stack Overflow or respective owner

Related posts about c++

Related posts about namespaces