Review Questions

1:What is a class?
2:How does a class accomplish abstraction, encapsulation, and data hiding?
3:What is the relationship between an object and a class?
4:In what way, aside from being functions, are class function members different from class data members?
5:Define a class to represent a bank account. Data members should include the depositor's name, the account number (use a string), and the balance. Member functions should allow the following:
  • Creating an object and initializing it.

  • Displaying the depositor's name, account number, and balance

  • Depositing an amount of money given by an argument

  • Withdrawing an amount of money given by an argument

Just show the class declaration, not the method implementations. (Programming Exercise 1 ...

Get C++ Primer Plus, Fourth Edition 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.