I'm having a bit of trouble with friend functions and classes...
I know that you can have a class be freely accessed by a certain function if you use the friend operator...
IIRC, this lets A() access anything it wants in the MyClassType. What do I do if I only want A() to be able to call one function in a certain class?
int A( MyClassType* MyClass );
friend int A( MyClassType* MyClass );
int A( MyClassType* MyClass )
MyClass->B = 3;
What I'm trying to do is instead of making the entire GCoreType class accessible to the HandleEvent function, i just want ONE function on the GCoreType to be accessible (along with all the public junk of course).
bool HandleEvent( GCoreType* Core, EventType* Event );
... // Data and stuff
bool ReceiveCommandFromHandleEvent( int Command ) friend bool HandleEvent( GCoreType* Core, EventType* Event );
... // Other stuff
bool HandleEvent( GCoreType* Core, EventType* Event )
if( Event->eType == appStopEvent )
Core->ReceiveCommandFromHandleEvent( 0 );
I know that up there is syntactically incorrect. What I want to know is if what I'm trying to do is possible.