Chapter 14. FRIENDS, EXCEPTIONS, AND MORE

You will learn about the following in this chapter:

  • Friend classes

  • Friend class methods

  • Nested classes

  • Throwing exceptions, try blocks, and catch blocks

  • Exception classes

  • RTTI (runtime type information)

  • dynamic_cast and typeid

  • static_cast, const_cast, and reinterpret_cast

This chapter ties up some loose ends, then ventures into some of the most recent 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 recent additions discussed here are exceptions, RTTI, and improved type cast control. C++ exception handling provides a mechanism for dealing with unusual occurrences that otherwise would bring ...

Get The Waite Group's C++ Primer Plus, Third Edition 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.