I have a class called Location, and I need to add CArray to its member variables. This change made it necessary to overload the assignment operator.
Is there a way to copy all the variables of this type that were copied before I made the changes and just add extra code to copy the CArray without copying each individual member variable individually?
Location& Location::operator=(const Location &rhs)
{
if (this != &rhs)
{
m_LocationsToSkip.Copy(rhs.m_LocationsToSkip);
var1 = rhs.var1;
var2 = rhs.var2;
}
return *this;
}
source
share