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) {
mFreeCalls=0;

mMaxFreeCalls=3;

mMinTopup=1.0;
}

I then also have the following overloaded operator described below which makes
LHS=RSH.

AdvancedAccount& AdvancedAccount:perator= (const AdvancedAccount& raa) {
//this=MobileAccount::=raa;
mFreeCalls=raa.mFreeCalls;
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

MobileAccount::operator=((MobileAccount)raa);
MobileAccount::operator=((MobileAccount)raa);

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

etc.

No problem, this is how I'm procrastinating.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.