Click to See Complete Forum and Search --> : Pointer to Object


DiDi
October 5th, 1999, 04:52 AM
I got a Pointer-Var.:

Action *pAction=List->pAktion


I want to call a function looks like this:

int SendAction(Aktion oAktion){...}


How to convert the Pointer so I can call the function without changing it (the function).

Thank you *** * * * * * * * * * * * * * * * * *

Oleg Lobach
October 5th, 1999, 05:16 AM
Hi,
Try this:

Action *pAction=List->pAktion;
int nResult= SendAction(*pAction);




Hope this helps,
Oleg.

MikeM
October 5th, 1999, 07:14 AM
As a quick word of explanation, preceding a pointer with a '*' dereferences it.
i.e. If...

Action* pAction = List->pAktion;

then...

pAction ...is a pointer to an Action object, and...
*pAction ...is the object to which pAction is pointing.

Thus...

pAction->SomeFunction() ...and...
(*pAction).SomeFunction()

...are the same thing.

Hope this helps.

MikeM