The base class from which each class is derived is declared before the declaration of the derived class. It is not sufficient to provide a forward-referencing declaration for a base class; it must be a complete declaration.
for example:
class A; // forward declaration
// compile error; A must be defined class B : public A {
the size of an empty class or structure is not zero. it is one.
ReplyDeletehttp://tinf2.vub.ac.be/~dvermeir/c++/emptyopt.html
The base class from which each class is derived is declared before the declaration of the derived class. It is not sufficient to provide a forward-referencing declaration for a base class; it must be a complete declaration.
ReplyDeletefor example:
class A; // forward declaration
// compile error; A must be defined
class B : public A
{
};
class A
{
};