Object Oriented Programming - Inheritance
Object Oriented Programming - Inheritance
Object Oriented Programming - Inheritance
PROGRAMMING:
INHERITANCE
Dominique, Adron and Taniya
WHOA!
“I might not think that programmers are
artists, but programming is an extremely
creative profession. It’s logic-based
creativity.” ~ John Romero
TABLE OF CONTENTS
0 INTRODUCTION
What is Inheritance in OOP?
0 EXAMPLE
Illustration of how
1 2 inheritance is used
0 ADVANTAGES 0 DISADVANTAGE
Pros S
Cons
3 4
01
INTRODUCTIO
N
What is Inheritance?
DEFINING THE
CONCEPT
Inheritance is a fundamental concept in object-oriented programming
(OOP). It allows a new class (called the "subclass" or "child class") to inherit
attributes and methods from an existing class (called the "superclass" or
"parent class"). The subclass can then extend or modify the behavior of the
superclass by adding its own attributes and methods or by overriding
existing ones.
EXAMPLES
02
An example to illustrate the concept
TYPES OF INHERITANCE
0 SINGLE
In single inheritance, a subclass (or
0 MULTIPLE
In multiple inheritance, a subclass
0 MULTILEVEL
In multilevel inheritance, a
0 HIERARCHY
In hierarchical inheritance,
A CAR AN A DOG A
IS A VEHICLE ORANGE
IS A FRUIT IS AN ANIMAL SURGEON
IS A DOCTOR
03
ADVANTAGES
Pros of inheritance in OOP
ADVANTAGES
Inheritance promotes code reuse by allowing subclasses
to inherit attributes and methods from their superclasses.
Code Reusability This reduces redundancy and improves maintainability, as
common functionality only needs to be implemented
once in the superclass.