O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart 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

17 Polymorphism: Object Independence

To be most useful, objects need independence. Each should act as though it were a miniature computer that can send and respond to messages. As long as a new object type uses the appropriate interface, you should be able to plug it into existing software.

Literally, polymorphism means “many forms.” On the most basic level, it means the ability to implement the same operation multiple ways. Stated that way, it’s trivial. But the real point is this: without changing anything about the code that uses an object, you can substitute another object type and the program will still work.

Consider an analogy. Your word processor can successfully interact with any kind of printer you purchase. You can even, five years ...

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