A class name whose declaration has not yet been encountered by the compiler can be used in an extern declaration. The name introduced with such a declaration cannot be used until the class declaration has been encountered.
Is this correct example ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class A;
void fun(A ob); //extern declaration
class A
{
//...
};
void fun(A ob)
{
//here we use ob and its data members
}
int main()
{
A x;
fun(x);
}