Inheritance in Object Oriented Programming:
Inheritance is the process of creating new classes from an existing class. The existing class is known as the base class and the newly created class is called a derived class. The derived classes inherit the properties of base classes.
If the derived class inherits from a single parent, the inheritance is said to be single inheritance. Multiple inheritances are the process of creating a new class from more than one base classes. Inheritance can be viewed as a hierarchical structure where the base class is at root shown with its derived classes at different levels.
class shape
{
……………
};
class circle: public shape
{
………….
};
class rectangle : public shape
{
…………….
};
Class square : public rectangle
{
………………
};
Thanks
Mukesh Rajput
Post A Comment:
0 comments: