shape
and each shape has a color, size, and so on.
From this, specific types of shapes are derived (inherited)—circle, square, triangle, and so on—each of which may have additional characteristics and behaviors.
For example, some behaviors may be different, such as the area of a shape.
The type hierarchy embodies both the similarities and differences between the shapes.
Note that the type of area has been changed from double to int .
|