![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
operator += with user-defined classes.
Hi, the operator + function for my class works fine, but I think I'm having trouble with the +=. Is this how you should do it?
Scene& Scene::operator +=(Scene param)
{
*this=*this+param;
return *this;
} |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Nov 2004
Posts: 250
Rep Power: 4
![]() |
+= is actually more fundamental than +. Try defining += as a member function of your class and then defining + as a non-member function in terms of +=.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|