Hi,
Well, you can use forward declaration if you want to refer to the class before defining it. You can't get the compiler to read all the way to the end, so it won't actually know how class B is defined, so you can just add a reference to it, not an actual object.
So, you could use:
but can't useCode:class B; class A { ... B *myArray[100]; ... }; class B: public A { ... };
Code:class B; class A { ... B myArray[100]; //!error! ... }; class B: public A { ... };




Reply With Quote
