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
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: