O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Third Edition by Brian Overland

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

12. Two Complete OOP Examples

In the last two chapters, I laid out the basic syntax of class and object declarations. Now we’re ready to apply object-oriented principles to programs that do something fun and useful.

First, I’ll explore a Binary Tree example, which is one of the more intriguing and challenging topics in programming, and then I’ll return to the Tower of Hanoi puzzle from Chapter 5, “Function: Many Are Called.” The new version of the program uses character-based animation to show the puzzle solution in action.

But first, a few more preliminaries....

Dynamic Object Creation

Pointers have yet another use: constructing networks of objects. This is called dynamic memory allocation because it requests memory at run time, letting the ...

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