Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (6.5k points)
What is the difference between function overriding and function overloading?

1 Answer

0 votes
by (11.3k points)

Function/Method Overriding and Overloading are implementations of Object-Oriented Programming (OOP) concepts, namely, Inheritance and Polymorphism

In the case of Method overriding, a child class of a parent class can have a function that has the same name and signature as a function present in its parent class. When the function is invoked in the child class, it has the option to inherit the data members and member functions of the parent class or override or change certain attributes and behavior according to its need based on the same parent template. It inherits its base properties from the parent but can make itself unique by overriding those properties according to its need. 

Method overloading occurs when two or more functions have the same name but are only differentiated by their signatures (return type, argument data types, number of arguments). Each of these functions are independent of one another and can do entirely separate tasks. This achieves polymorphism i.e having many forms.

These concepts in JAVA can be clearly understood with some hands-on experience by following Java course:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...