Monday, April 27, 2009

INHERITANCE

Introduction:
Inheritance is a process of deriving new classes from existing classes. The derived classes contain all attributes and functions of existing classes and its own attributes and functions. The existing classes are called base classes and the inherited classes are called derived classes. For eg.:


Here Academic is a derived class of Students which is derived from the base class College. So it contains all the attributes and functions of Students and College plus its own attributes and functions.
Salary is a derived class of Staffs which is derived from the base class College. So it contains all the attributes and functions of Staffs and College plus its own attributes and functions
Wages is a derived class of Workers which is derived from the base class College. So it contains all the attributes and functions of Workers and College plus its own attributes and functions

Inheritance is the process of creating new classes from the existing classes. The new classes are called derived classes. The existing classes are called base classes.


No comments:

Post a Comment