Contents

Section 7.1 Defining Abstract Data Types

Section 7.2 Access Control and Encapsulation

Section 7.3 Additional Class Features

Section 7.4 Class Scope

Section 7.5 Constructors Revisited

Section 7.6 static Class Members

Chapter Summary

Defined Terms

In C++ we use classes to define our own data types. By defining types that mirror concepts in the problems we are trying to solve, we can make our programs easier to write, debug, and modify.

This chapter continues the coverage of classes begun in Chapter 2. Here we will focus on the importance of data abstraction, which lets us separate the implementation of an object from the operations that that object can perform. In Chapter 13 we’ll learn how to control what happens when objects are copied, ...

Get C++ Primer, Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.