You can get stuck at the object-based
level because you can quickly get there and you get a lot of benefit
without much mental effort. It’s also easy to feel like
you’re creating data types – you make classes and objects, you
send messages to those objects, and everything is nice and neat. But
don’t be fooled. If you stop here, you’re missing out on the
greatest part of the language, which is the jump to true
object-oriented programming. You can do this only with virtual
functions. — Bruce Eckel, Thinking
in C++, 2000
For this unit, work through the following preparatory
activities.
Sections 12.1–12.4 from the online text
Read F.P. Brooks, The Joys (and Woes) of the Craft.
With which of Brook’s points, joys or woes, do you most identify?
This video demo — key ideas not emphasized in the
text:
- The three basic elements of object-oriented programming
- Inheritance as a mechanism for sharing
- Polymorphism as a mechanism for distinguishing
- Is-a, has-a and instance-of; the text only discusses two of them.
You can find the final version of the sample code here: code/simple_draw/*