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.
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.
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.
thanks Mr. Spigot
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.