Inheritance Please
To get full credit you need to have at least one class derived from another
one, and the derivation needs to make sense. For example,
class Knife : public Weapon ....is OK because
But
class Handle : public Knife ...is not OK becuase a Handle is a part of a knife.
Remember that when you are stuck writing or debugging code, it helps
to shift to pictures and diagrams. Rough UML can help.
Write a Main Program to test classes
When asked to develop one or more classes you should
also develop and hand in a main program that tests the classes.
Polymorphism Please
To test for polymorphism you need to declare a pointer to a base
class that actually refers to an object in a derived class:
Base * p = new Derived(....);and then test for the behavior defined in the derived class:
assert ( p->function(...) == the result in derived class );for example.
Big problem -- how to draw shapes on the screen with out a cool graphics package.
. . . . . . . . . ( end of section Suitable Exercises at end of Chapter 13) <<Contents | End>>
. . . . . . . . . ( end of section Project 3 Chapter 13 Inheritance and Polymorphism) <<Contents | End>>
Abbreviations