Why We Need Polymorphic Objects

You may be wondering what an “idiom” is in programming. Well, in English or any other natural language, an idiom is a phrase whose meaning can't be derived directly from the meanings of its individual words. An example would be “to make good time”, which actually means “to proceed rapidly”. Similarly, the manager/worker idiom used to implement polymorphic objects has effects that aren't at all obvious from a casual inspection of its components.

I should tell you that many, if not most, professional C++ programmers don't know about this method of making polymorphism safe and easy to use for the application programmer. Why, then, am I including it in a book for relatively inexperienced programmers?

Because I believe ...

Get C++: A Dialog Programming with the C++ Standard Library 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.