0% found this document useful (0 votes)
54 views10 pages

Inheritance: Mrs. Ignisha Rajathi

The document discusses inheritance in object-oriented programming. Inheritance allows a new derived class to inherit traits from a base class, enabling code reuse. There are different types of inheritance including single inheritance where a derived class has one base class, multiple inheritance with two or more base classes, and hierarchical and multilevel inheritance involving derived classes inheriting from other derived classes.

Uploaded by

johnyelton
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views10 pages

Inheritance: Mrs. Ignisha Rajathi

The document discusses inheritance in object-oriented programming. Inheritance allows a new derived class to inherit traits from a base class, enabling code reuse. There are different types of inheritance including single inheritance where a derived class has one base class, multiple inheritance with two or more base classes, and hierarchical and multilevel inheritance involving derived classes inheriting from other derived classes.

Uploaded by

johnyelton
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 10

Inheritance

Mrs. Ignisha Rajathi


Inheritance
• Reusability is yet another important feature of
OOP.
• It is always nice if we could reuse something
that already exists than trying create the same
all over again.
– C++ strongly supports the concept of reusability.
Inheritance …
• The mechanism of deriving a new class from
an old one is called inheritance (or derivation).
– Old class – Base class
– New class – Derived class or sub class
• Derived class inherits some or all the traits from the
base class.
Inheritance …
• Various forms of Inheritance:
• Single Inheritance
• Multiple Inheritance
• Hierarchical Inheritance
• Multilevel Inheritance
• Hybrid Inheritance
Inheritance …
• Single Inheritance (Derived class with only one Base class )

A Base Class

B Derived class
Inheritance …
• Multiple Inheritance Two Base Classes

A B

C Derived class

• One or more base classes


Inheritance …
• Hierarchical Inheritance
– [traits of one class may be inherited by more than one class (derived class) ]
A

B C D
Inheritance …
• Multilevel Inheritance (deriving a class from already derived
class)
A

C
Inheritance …
• Hybrid Inheritance

B C

D
Inheritance …

You might also like