Skip to Main Content
Practical C++
book

Practical C++

by Rob McGregor
August 1999
Beginner to intermediate content levelBeginner to intermediate
912 pages
15h 44m
English
Que
Content preview from Practical C++

Chapter 27. Using Dynamic Casting and Runtime Type Identification

<feature>
  • See how polymorphic objects canl provide runtime type information

  • Use the new C++ casting operators

  • Learn to cast dynamically

  • See how C++ static casting is like C-style casting

</feature>

Getting and Using Runtime Type Information

When working with class hierarchies, it’s sometimes convenient or necessary to create a pointer of one type and convert it later to some other pointer type. You can always safely cast a derived object pointer to a base object pointer because the base class is part of the derived class. You can then use the derived object pointer to call functions from the base class. On the other hand, a base class can sometimes—but not always—be type cast as a pointer ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical C++ Programming, 2nd Edition

Practical C++ Programming, 2nd Edition

Steve Oualline
C++ Cookbook

C++ Cookbook

D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, Jeff Cogswell

Publisher Resources

ISBN: 0789721449Purchase book