Tapestry, Extra Material
Programs Illustrating Inheritance
Students eating, working, sleeping
-
Simple example of inheritance, derived class overrides behavior
of concrete base class. Example based on generic student and Duke
student, but Duke can easily be changed to other schools.
Roulette, more inheritance, more classes
- Two versions of a program to play roulette. These are functionally
similar, but use different techniques: one uses encapsulation only, the
other uses inheritance and more classes.
- A non-object-oriented version, uses classes, but
no inheritance:
- A more object-oriented version using inheritance for the bet
classes.
Owen L. Astrachan
Last modified: Wed Aug 27 21:36:26 EDT 1997