How to set reference property in assingment operator ?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to set reference property in assingment operator ?

  1. #1
    Join Date
    Jan 2011
    Posts
    5

    Thumbs up How to set reference property in assingment operator ?

    Hi
    If I have a property in my class int &age , how would I reset its value inside assignment operator ??

    Also in c++ is there any way I can call parent virtual function inside my subclass ??

    thanks in Advanc.e

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,888

    Re: How to set reference property in assingment operator ?

    You cannot change what a reference is directed at once it is created. If you need your class to be assignable, then use a pointer instead of a reference as your member.

  3. #3
    Join Date
    Jan 2006
    Location
    Belo Horizonte, Brazil
    Posts
    405

    Re: How to set reference property in assingment operator ?

    I think Lindley cleared your first doubt. For the second one you can do, for example:
    Code:
    void DerivedClass::functionName() {
      BaseClassName::functionName();
      //...
    }

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center