Chapter 4. Classes

C++ classes are the fundamental building blocks of object-oriented software. Class definitions describe objects that software systems create and manipulate. Object-oriented programs typically contain many different objects, all instantiated (or created) from C++ classes. Before we tackle object-oriented programming though, we need to understand what a C++ class is and how it works.

This chapter introduces encapsulation and C++ classes from two perspectives: the inside view (how objects work) and the outside view (what objects do). We'll look at class data members, member functions, constructors, destructors, and class member initialization.

Get Navigating C++ and Object-Oriented Design 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.