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 23. Understanding Polymorphism

<feature>
  • Learn to create abstract classes and define virtual functions

  • See how virtual functions work

  • Use pointers to classes in a hierarchy

  • Discover how to avoid the problem of class slicing

  • Realize the importance of using virtual destructors with polymorphism

</feature>

What Is Polymorphism?

When I was a kid, I used to enjoy playing the game Dungeons and Dragons, and I still play it sometimes with my son. (He likes it, too.) The game allows you to choose one of several types of characters, such as a warrior or a wizard, and take on that character’s role. In the game, I often choose to play the role of a wizard, working magic and casting spells to help fellow players as needed. One of my favorite spells is called ...

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