×

Discussion Board

Results 1 to 2 of 2

Thread: Pointers

  1. #1
    Regular Contributor
    Join Date
    Jan 2008
    Posts
    70

    Question Pointers

    Hi, i have an object that need to receive some parameter values but not in the Construction phase but later using a method like
    Code:
    Type* iData;
    
    //do something
    
       MyObject->SetValue(iData)


    But when i try to asign the value it says cant do the operation '=', what i try to do is this?

    Code:
    Type* value;
    
    .....
    
    void CMyObject::SetValue(Type& aParameter) {
    
    value = aParameter;
    
    }
    I know that when its in construnction, i can do a

    Code:
    CMyObject::CMyObject(Type& aParameter) 
    : value(aParameter) 
    {
    //do stuff
    }
    And it works, but what i need is to do this once my object is fully created, how can i do this???

  2. #2
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: Pointers

    Its a pointer type you need to assign address to it using addressof operator, so do it like this
    value = &aParameter;

Similar Threads

  1. Phone > PC app > web — need pointers for the PC app
    By kwameferreira in forum Mobile Java Games
    Replies: 2
    Last Post: 2007-01-04, 18:18
  2. Two Dimensional Array of Pointers to functions
    By ash_bhatia in forum Symbian
    Replies: 4
    Last Post: 2006-01-13, 04:24
  3. Delete a 2dim array of pointers
    By ghioldi in forum Symbian
    Replies: 0
    Last Post: 2003-07-21, 08:30

Posting Permissions

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