An incomplete class declaration is a class declaration that does not define any class members. You cannot declare any objects of the class type or refer to the members of a class until the declaration is complete. However, an incomplete declaration allows you to make specific references to a class prior to its definition as long as the size of the class is not required.
struct first; // incomplete declaration of struct first
struct second // complete declaration of struct second
{
first* oneptr; // pointer to struct first refers to
// struct first prior to its complete
// declaration
first one; // error, you cannot declare an object of
// an incompletely declared class type
int x, y;
};
struct first // complete declaration of struct first
{
second two; // define an object of class type second
int z;
};
class X; // incomplete class declaration
class Z {}; // empty member list
class Y
{
public:
X yobj; // error, cannot create an object of an
// incomplete class type
Z zobj; // valid
};