15. Friends, Exceptions, and More

In this chapter you’ll learn about the following:

• Friend classes

• Friend class methods

• Nested classes

• Throwing exceptions, try blocks, and catch blocks

• Exception classes

• Runtime type identification (RTTI)

dynamic_cast and typeid

static_cast, const_cast, and reinterpret_cast

This chapter ties up some loose ends and ventures into some of the later additions to the C++ language. The loose ends include friend classes, friend member functions, and nested classes, which are classes declared within other classes. The later additions discussed here are exceptions, runtime type identification (RTTI), and improved type cast control. C++ exception handling provides a mechanism for dealing with unusual occurrences ...

Get C++ Primer Plus 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.