1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
class Account
{
public:
Account() : number(0), owner(""), balance(0), interest(0) {}
Account(const int _number, string &_owner, double _balance, double _interest) : number(_number), owner(_owner), balance(_balance), interest(_interest) {}
Account(const Account&rhs) : number(rhs.number), owner(rhs.owner), balance(rhs.balance), interest(rhs.interest) {}
Accountoperator=(const Account&rhs)
{
if (&rhs == this)
{
return *this;
}
number = rhs.nummer;
owner= rhs.owner;
balance = rhs.balance;
interest = rhs.interest;
return *this;
}
//Metod: Sets the necessary info
void SetInfo(const int _number, string &_owner, double _balance, double _interest)
{
number = _number;
owner= _owner;
balance = _balance;
interest = _interest;
}
// Accessor functions
int Number() const { return number; }
const string &Owner() const { return owner;}
double Balance() const { return balance; }
double Interest() const { return interest; }
//Member variables
private:
int number;
string owner;
double balance;
double interest;
};
|