-
January 31st, 2011, 03:51 PM
#1
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
-
January 31st, 2011, 03:57 PM
#2
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.
-
January 31st, 2011, 05:48 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|