Relationship of inheritance in oopm.pptx

ayush626953 13 views 18 slides May 18, 2025
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

this is all about the inheritance which include examples,relationship and types of inheritance


Slide Content

Relationship of Inheritance By : Ayush Agrawal

CD 305 2 Introduction to oop Brief Overview of Object-Oriented Programming Object-Oriented Programming (OOP) is a programming paradigm that organizes software design around objects , which are instances of classes . In OOP, data (attributes) and functions (methods) are bundled together into units called objects, making the code more modular, reusable, and maintainable.

Hierarchy : It enables the creation of a class hierarchy where subclasses inherit generalized behavior from a more specific base class, fostering better organization of the codebase. Extensibility : Inheritance allows new features and methods to be added to derived classes without altering the existing code in base classes. Polymorphism : Inheritance enables polymorphic behavior, where derived classes can override base class methods, allowing dynamic method calls at runtime. Subject Code 3

CD 305 4 Code Reusability Maintainability Encapsulation Abstraction Inheritance Polymorphism Importance of Inheritance

Inheritance : is a core principle of Object-Oriented Programming (OOP) where one class (child class) inherits properties and behaviors (methods) from another class (parent class). It allows code reuse, flexibility, and better organization of classes. CD 305 5 What is Inheritance ?

Real-Life Example of Inheritance General Concept (Parent Class) : Animal Common attributes: name, age Common method: makeSound () Specific Types (Child Classes) : Dog : Has an additional method bark() Bird : Has an additional method fly() Subject Code 6

CD 305 7 Types of Inheriitance Single Inheritance Multiple Inheritance Multilevel Inheritance Hierarchical Inheritance Hybrid Inheritance

Single inheritance In single inheritance , a child class inherits from only one parent class. Subject Code 8

Subject Code 9

Multiple Inheritance This type of inheritance happens  when the child class inherits its properties from more than one base class . In other others, the derived class inherits properties from multiple base classes. Subject Code 10

Subject Code 11

Multilevel inheritance This type of inheritance is the  best way to represent the transitive nature of inheritance . In multilevel inheritance, a derived class inherits all its properties from a class that itself inherits from another class . Subject Code 12

Subject Code 13

 Hierarchical Inheritance when multiple child classes inherit their properties from just a single base class . Subject Code 14

Subject Code 15

Hybrid Inheritance This type of inheritance essentially  combines more than two forms of inheritance  discussed above. Subject Code 16

Subject Code 17

CD 305 18 Conclusion Inheritance represents a way of passing on properties, behaviors, or characteristics from one entity (such as a class or parent object) to another (such as a subclass or child object ). It enables code reusability, reduces redundancy, and enhances maintainability in object-oriented programming
Tags