I have a class hierarchy and i am writing a virtual function in it. Say there are three classes
class A { virtual A* test(); }; ( File A.h )
class B : public A { virtual C* test(); }; ( File B.h )
class C : public A {}; ( File C.h )
Now is it possible for me to avoid including C.h in B.h, by doing some kind of forward declaration saying that C is a sub-class of A?
Thanks,
Gokul.
You can tell the compiler only three things, in three different ways, about a class
C:If you want to tell the compiler what the class derives from then you’re talking about how the class is structured. You must then show the compiler the class’ declaration, there’s no other way.