CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    Austria
    Posts
    116

    Pointer to Object

    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 *** * * * * * * * * * * * * * * * * *

  2. #2
    Join Date
    Jul 1999
    Location
    Moscow, Russia
    Posts
    667

    Re: Pointer to Object

    Hi,
    Try this:

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




    Hope this helps,
    Oleg.


  3. #3
    Join Date
    Sep 1999
    Posts
    21

    Re: Pointer to Object

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured