Let us imagine that a particular class is developed and used in some program. Now, another class is needed which is similar to this class but with more functionality (power). Does the time consumed in developing this class go waste? No, the Inheritance principle allows us to define a new class based on the previously designed class. We are required only to write a code related to additional functionality. The previously developed class is directly used. In technical jargon, the new class inherits the properties of old class.
Consider a case where you want to develop class
Time12. Assume that you have class
Time24 stands for twenty-four hours clock. The hours can take values between 0 ...