Exercises
-
3.5 (Default Constructor) What’s a default constructor? How are an object’s data members initialized if a class has only a default constructor defined by the compiler?
-
3.6 (Data Members) Explain the purpose of a data member.
-
3.7 (Using a Class Without a
usingDirective) Explain how a program could use classstringwithout inserting ausingdirective. -
3.8 (Set and Get Functions) Explain why a class might provide a set function and a get function for a data member.
-
3.9 (Modified
AccountClass) Modify classAccount(Fig. 3.8) to provide a member function calledwithdrawthat withdraws money from anAccount. Ensure that the withdrawal amount does not exceed theAccount’s balance. If it does, the balance should be left unchanged ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access