0

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

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by adam1122
0
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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.