Q36. Hint: Watch out for the destructor-call. I15 Marksl include Kios include us
ID: 3817961 • Letter: Q
Question
Q36. Hint: Watch out for the destructor-call. I15 Marksl include Kios include using namespace std class bank account private double m balance: string m name Public bank account bank account bank account (double the balance bank account (string the name bank a (double the balance string the name) ccount bank account (string the name double the balance double get balance string get name void set balance (double the balance) void set name (string the name) void deposit (double money) double withdraw (double money) 77 bank accounts .cPP #include bank account t.h bank account bank account m balance o; m name No name bank account bank account tt) balance of "Explanation / Answer
First line of output is by cout statement
cout << "harry.get_name() < " has a balance of " << harry.get_balance() << "dollars. " << endl;
here harry.get_anme return colin because colin is assigned to harry (and is copied in harry). (os it is essentially calling collin.get_balance() and colin.get_balance()
Second line
Now terry has been assigned katie so it will print results for katie.
Name of katie variable is Katie and its balance is (20+10) (Katie took 30 rs from colin)
Third and Fourth line
terry set its name to Terry
Terry tried to withdraw 50 and she doesn't have that amouint and hence message is printed
Fifth line
hannah's details are printed
After that destructor are called in opposite order of creation printing money for each person.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.