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
using
Directive) Explain how a program could use classstring
without inserting ausing
directive. -
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
Account
Class) Modify classAccount
(Fig. 3.8) to provide a member function calledwithdraw
that withdraws money from anAccount
. Ensure that the withdrawal amount does not exceed theAccount
’s balance. If it does, the balance should be left unchanged ...
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.