0

I have a doubt regarding forwarding declaration.

in .h file:

class B;
class A{
 void func(B* tap);
}

in .cpp file

void A::func(B* tap){
tmpo=tap->par1;
}

does the above code snipet correct if not whats the problem. Please be descriptive.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by majesticmanish
0

That snippet cannot work because, in func the compiler is unable to handle tap->par1. The details of class B are unknown at this point.
The header file will compile, but the cpp file will need another include which contains the class definition for B.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.