Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Forward declaration Doubt (http://www.go4expert.com/forums/forward-declaration-doubt-t16752/)

majesticmanish 1Apr2009 13:16

Forward declaration Doubt
 
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.

shabbir 1Apr2009 16:12

Re: Forward declaration Doubt
 
In .cpp file I assume you have included the .h file and if that is true its correct but then tmpo and other variables are in doubt

Mridula 1Apr2009 16:19

Re: Forward declaration Doubt
 
You need have to include the .h file for declaration for class A in the file where "class B" declaration is there.
Apart from that tempo is what here?

majesticmanish 1Apr2009 16:38

Re: Forward declaration Doubt
 
I got my doubt clear. I have to include B.h file in A.cpp file as earlier i was in a doubt since i already had made forward declaration of B in A's header file.

tempo is nothing imp. here....just a part of rough-code.

btw, thanks 4 clearing my doubt.


All times are GMT +5.5. The time now is 13:07.