3.1 Introduction 1

Section 1.8 presented a friendly introduction to object orientation, discussing classes, objects, data members (attributes) and member functions (behaviors).2 In this chapter’s examples, we make those concepts real by building a simple bank-account class. The class maintains as data members the attributes name and balance, and provides member functions for behaviors including

  • querying the balance (getBalance),

  • making a deposit that increases the balance (deposit) and

  • making a withdrawal that decreases the balance (withdraw).

We’ll ...

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.