0% found this document useful (0 votes)
4 views3 pages

Inheritance in Object

Uploaded by

haremurari822
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Inheritance in Object

Uploaded by

haremurari822
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

TECHNO INSTITUTE OF ENGINEERRING AND MANAGEMENT

NAME : DEBJANI GHOSH

ROLL : 24430823011

DEPARTMENT : CSE (AIML)

SEMESTER : 5TH

SUBJECT : Object-Oriented Programming(PCC- CS503)

TOPIC : Inheritance
Inheritance in Object-Oriented Programming

Introduction

Inheritance is one of the most fundamental principles of Object-Oriented Programming


(OOP). It allows a class, known as a subclass (child class), to derive attributes and
behaviours from another class, known as a superclass (parent class). This mechanism
promotes code reusability, extensibility, maintainability, and logical hierarchy
construction. By reducing redundancy and enabling hierarchical relationships, inheritance
helps software developers model real-world systems more effectively.

Literature Survey

The concept of inheritance originated with the Simula language (1967), widely recognized
as the first object-oriented programming language. Later, Smalltalk (1970s) advanced the
use of inheritance and polymorphism. Since then, inheritance has been a cornerstone of
modern programming languages like C++, Java, and Python.

 C++ supports single, multilevel, hierarchical, and multiple inheritance.

 Java supports single, multilevel, and hierarchical inheritance but avoids multiple
inheritance using interfaces to prevent ambiguity (diamond problem).

 Python allows both single and multiple inheritance, giving flexibility in design.

Recent studies highlight that while inheritance is powerful, excessive or improper use can
lead to tight coupling and maintenance difficulties. Modern design principles (e.g.,
SOLID) often suggest “favor composition over inheritance” for flexibility.

Diagram and Analysis

Class Hierarchy Diagram

Vehicle (Superclass)

/ \

Car Bike

(Subclass) (Subclass)
Analysis

1. Code Reusability – The Vehicle superclass may define properties like speed, fuel(),
and start(). Subclasses (Car, Bike) can directly reuse them without redefining.

2. Extensibility – New types of vehicles (e.g., Truck) can be added without modifying
existing code.

3. Polymorphism – Subclasses override superclass methods for specialized behavior


(e.g., Car.start() vs. Bike.start()).

4. Limitations – Multiple inheritance (in some languages) may lead to the diamond
problem, causing ambiguity in method resolution.

Overall, inheritance enhances modularity and efficiency in design but requires careful
application to prevent complexity.

References

1. Booch, G. (1994). Object-Oriented Analysis and Design with Applications. Addison-


Wesley.

2. Stroustrup, B. (2013). The C++ Programming Language. Addison-Wesley.

3. Eckel, B. (2006). Thinking in Java. Prentice Hall.

You might also like