Class Point3 (Figs. 4.20-4.21) declares data members x and y as private and exposes member functions setX, getX, setY, getY and print for manipulating these values.
Figure 4.20:
Point3 class header file. Point/Circle Hierarchy Using private Data
|
Figure 4.21:
Point3 class uses member functions to manipulate its private data.
|
Figure 4.22:
Circle4 class header file.
|
Figure 4.23:
Circle4 class that inherits from class Point3, which does not provide protected data. (part 1 of 2)
|
Figure 4.24:
Circle4 class that inherits from class Point3, which does not provide protected data. (part 2 of 2)
|
Figure 4.25:
Base class private data is accessible to a derived class via public or protected member function inherited by the derived class.
|
2004-07-29