int main() {
B bb; //does not compile (neither does class B bb;)
C cc; //does not compile
struct t tt; //compiles
class B {}; //HERE is the class B defination
struct s { struct t * pt; }; //compiles
struct t { struct s * ps; };
return 0;
}
class C {};
I just modified the example given here.
Why is that the struct forward declarations work but not the class forward declarations?
Does it have something to do with the namespaces - tag namespace
and typedef namespace
? I know that the structure definitions without typedefs go to tag namespace.
Structures are just classes with all public members. So, I expect them to behave similarly.