PeteJM01

Hi everyone,

In my RTS game that I am building I have a Terrain class that attributes the APPLICATION class as a friend.

Code Snippet

class TERRAIN{

...

friend class APPLICATION;

...

}

I can tell that the APPLICATION class in not being included as a friend because I get an error when trying to build saying that:

error C2039: 'm_pFogOfWarTexture' : is not a member of 'TERRAIN'

m_pFogOfWarTexture is located in APPLICATION and the variable is being called from my PLAYER class vai:

m_pTerrain->m_pFogOfWarTexture

Can anyone see why this could be occuring.

Thanks is advance.




Re: Visual C++ Language Problems with friend class

einaros

Well you're saying m_pFogOfWarTexture resides in the APPLICATION class, yet you attempt to access it in an instance of TERRAIN. Making APPLICATION an instance of TERRAIN will *not* introduce all APPLICATION members. It will, however, allow APPLICATION to access the private members of TERRAIN -- which is the purpose of 'friend'.





Re: Visual C++ Language Problems with friend class

PeteJM01

I think I may have found the problem, but if I find that I still have the problem I will post again.




Re: Visual C++ Language Problems with friend class

einaros

Well if the code is really as you depicted in your first post, I've already shown you the problem Smile