Constructors and Destructors in Derived Classes

Next example revisits the point/circle hierarchy by defining class Point4 (4.30-4.31) and class Circle5 (4.32-4.34) that contain constructors and destructors, each of which prints a message when it is invoked.




























Figure 4.30: Point4 class header file and Point4 base class contains a constructor and a destructor. (part 1 of 2)
\includegraphics[scale=0.43]{figures/img9.69.ps}
\includegraphics[scale=0.43]{figures/img9.70.ps}
Figure 4.31: Point4 base class contains a constructor and a destructor. (part 2of 2)
\includegraphics[scale=0.43]{figures/img9.71.ps}
\includegraphics[scale=0.43]{figures/img9.72.ps}
Figure 4.32: Circle5 class header file.
\includegraphics[scale=0.43]{figures/img9.73.ps}
\includegraphics[scale=0.43]{figures/img9.74.ps}
Figure 4.33: Circle5 class inherits from class Point4. (part 1 of 2)
\includegraphics[scale=0.43]{figures/img9.75.ps}
\includegraphics[scale=0.43]{figures/img9.76.ps}
Figure 4.34: Circle5 class inherits from class Point4. (part 2 of 2)
\includegraphics[scale=0.43]{figures/img9.77.ps}
\includegraphics[scale=0.43]{figures/img9.78.ps}
Figure 4.35: Constructor and destructor call order.
\includegraphics[scale=0.43]{figures/img9.79.ps}
\includegraphics[scale=0.43]{figures/img9.80.ps}
2004-07-29