May 2012
Intermediate to advanced
679 pages
16h 56m
English
Now consider a practical application. We want to use a computer as a digital clock! For any digital clock, time is the basic building block. It also shows AM/PM. We have already defined and used a class time0. How can we use it to our advantage? Principle of inheritance comes into the picture. We can define a new class called clock based on the previously defined class time0. A new class clock will inherit properties of old class time0.
With public derivation, a typical declaration will look as follows:
class Clock : public Time0
The class definition does the following:
Read now
Unlock full access