O'Reilly logo

The C++ Programming Language, Fourth Edition by Bjarne Stroustrup

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

22. Run-Time Type Information

Premature optimization is the root of all evil.

– Donald Knuth

On the other hand, we cannot ignore efficiency.

– Jon Bentley

Introduction

Class Hierarchy Navigation

dynamic cast; Multiple Inheritance; static_cast and dynamic_cast; Recovering an Interface

Double Dispatch and Visitors

Double Dispatch; Visitors

Construction and Destruction

Type Identification

Extended Type Information

Uses and Misuses of RTII

Advice

22.1. Introduction

In general, a class is constructed from a lattice of base classes. Such a class lattice is often called a class hierarchy. We try to design classes so that users need not be unduly concerned about the way a class is composed out of other classes. In particular, the virtual ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required