Im trying to make class A a friend of class B.
class B;
class A{
public:
void show(const B&); // ##1## but this one works fine
B ob;// error incomplete type
};
class B{
public:
int b;
B():b(1){}
friend class A;
};
so my question why it's incomplete type? I thought that when I did class B
it's like a prototype of a function which tell the compile there is a definition somewhere in the code.
also in the code above at ##1## why this is possible ?
See Question&Answers more detail:os