0% found this document useful (0 votes)
1 views

Cs3391 – Object Oriented Programming - Demo

Uploaded by

Vasanth S
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Cs3391 – Object Oriented Programming - Demo

Uploaded by

Vasanth S
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

COMPUTER SCIENCE

ENGINEERING
CS3391 – OBJECT
ORIENTED
PROGRAMMING
Inheritance and Types

VASANTH SRIDHAR - ME
OOPS CONCEPTS

• OOPS – object oriented programming language


• It is method of implementation in which program is organized as collection of object,
class and methods
• Object – run time memory allocation
• Method – set of actions to be performed
• Class – collection of objects and methods
TYPES OF OOPS CONCEPTS
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
Inheritance

• We can access one class property from another class by using extends keyword
• It is an important part of oops
Why to use Inheritance
• To reduce the number of object creation
• So that the memory wastage is low
• We can reuse the code where ever we need using extends call using current class object itself
• Parent class – gives property to child class
• Child class – accepts property from parent class
Types of inheritance

• Single Inheritance
• Multilevel Inheritance
• Multiple Inheritance
• Hierarchial Inheritance
• Hybrid Inheritance
Single Inheritace

Combination of one parent and one child class (A extends B)


Property of A class is passed to B class
Multilevel inheritance

More than one parent class accessing the class in a tree level structure (B extends A then C extends B),
it is a level by level inheritance
Multiple Inheritance

• More than one parent class accessing the child class parallelly at a time (C extends A,B)
NOTE:
• Multiple inheritance is not supported in java through class using extends keyword
• Because it shows syntax error in compile time due to the priority issue (ambiguity
problem)
• We can achieve this through the interface by using implement keyword
Priority issue/Ambiguity problem

It is the problem arises when the two parent class gives their property to their one child class at a same time,
at that time the child class will get confuse on which parent property to get(prioritize) first.
Hierarchial inheritance

Combination of one parent and more than one child (B extends A then C extends A)
Hybrid inheritance

Combination of any two or more types of inheritance.


THANK YOU

You might also like