| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| shape.cpp | 2013-11-12 00:11 | 3.4K | ||
| shape.h | 2013-11-12 00:11 | 2.0K | ||
| main.cpp | 2013-11-12 00:21 | 1.3K | ||
In this version, the Shape, Circle, and Rectangle classes are exactly the same as in the Shape 1 example. This one changes up the main.cpp test program to illustrate the important property that:
a base class pointer can be attached to an object derived from that base type
Also note that these pointers CAN be used to call upon functions in the Shape class (because they are of type Shape*), but they CANNOT be used to call Print() and Area(), because those functions are NOT in class Shape().
You can uncomment the last block to demonstrate this.