I have the following class called Advanced Account, which inheritis from MobileAccount. The
constructor for advanced account is defined below.

AdvancedAccount::AdvancedAccount(MobileNumber & rnum, string & rname) :MobileAccount(rnum,rname) {



I then also have the following overloaded operator described below which makes

AdvancedAccount& AdvancedAccount:perator= (const AdvancedAccount& raa) {
return *this;

The line in the overloaded method is the problem that I have. Ya see I want the MobileAccount LHS (this)
to be equal to the MobileAccount RHS. So to do this I wanna call the overloaded equals operator in the MobileAccount class. Thing is I dont know how to express this. Can someone help me with the line that I`ve
commented to show me how to write it properly.
Edit/Delete Message


How will this work? Because hasnt it got to set the MobileAccount of raa equal to the Mobile Account of this? Just woundering how that line works?

thanks for your fast rpely

I assumed you had an implementation of MobileAccount::operator= . If not, just write one. You just set each member variable of this equal to the member variable in raa .

this->rnum = raa.rnum


No problem, this is how I'm procrastinating.

This article has been dead for over six months. Start a new discussion instead.