Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Green University of Bangladesh

Course title: Object Oriented Programming


Course code : CSE 201
Course section : 221 D7
Presentation Topic : Method Overriding
Course Instructor
Group member Riad Muktadir
Fatema Akter
Lecturer 221002027
Department of Computer Science And Engineering
Green university of Bangladesh
Md. Shakib Hasan
221002397
Outline :

 Introduction

 How Does Work?


 Advantages

 Application

 Conclusions
Introduction

If subclass (child class) has the same method as declared


in the parent class, it is known as method overriding.

In other words, If subclass provides the specific (different)


implementation of the method that has been provided by
one of its parent class, it is known as Method Overriding.
How Does Works ?

 Method must have same name as in the parent class

 Method must have same parameter as in the parent class.


 Must be IS-A relationship (inheritance).
Advantages

 Method Overriding is used to provide specific implementation


of a method that is already provided by its super class.

 Method Overriding is used for Runtime Polymorphism.


APPLICATIONS
Example: Method Overriding
APPLICATIONS
Execution and Polymorphic Behavior :
Conclusions

Method overriding in Java allows a subclass to provide its


own implementation of a method inherited from its
superclass. By following the rules and using the correct
syntax, developers can effectively override methods and
customize the behavior of their classes.

You might also like