4. Classes

Those types are not “abstract”;they are as real as int and float.

– Doug McIlroy

Introduction

Concrete Types

An Arithmetic Type; A Container; Initializing Containers

Abstract Types

Virtual Functions

Class Hierarchies

Explicit Overriding; Benefits from Hierarchies; Hierarchy Navigation; Avoiding Resource Leaks

Copy and Move

Copying Containers; Moving Containers; Essential Operations; Resource Management; Suppressing Operations

Advice

4.1. Introduction

This chapter and the next aim to give you an idea of C++’s support for abstraction and resource management without going into a lot of detail:

• This chapter informally presents ways of defining and using new types (user-defined types). In particular, it presents the basic ...

Get A Tour of C++ 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.