Semester -    Subject -

What is method overloading?


If a class, has multiple methods having same name but different in parameters, it is known as Method Overloading.

Method overloading is a form of polymorphism in OOP. Polymorphism allows objects or methods to act in different ways, according to the means in which they are used. One such manner in which the methods behave according to their argument types and number of arguments is method overloading.

For example: 

Here, the func() method is overloaded. These methods have the same name but accept different arguments.



Share to whatsapp

More Questions from Module 0

Write a program that will take one string as input. The program will then remove vowels a, e, i, o, and u (in lower or upper case ) from the string. If there are two or more vowels that occur together then the program shall ignore all of those vowelsInput: Compuuter Output: Cmpuutr


View
Explain the concept of Direct and In-direct manipulation?
View
List out the steps of Candidate Elimination Algorithm. Apply the algorithm to obtain the final version space for the training example.
View
What is method overloading?
View

Input an email from the user. You have to create a username from the email by deleting the part that comes after ‘@’. Display that username to the user.

Example : 

email = “mejona@gmail.com” ; username = “mejona” 

email = “helloWorld123@gmail.com”; username = “helloWorld123”


View

Write a program that will take one string as input. The program will then remove vowels a, e, i, o, and u (in lower or upper case ) from the string. If there are two or more vowels that occur together then the program shall ignore all of those vowelsInput: Compuuter Output: Cmpuutr


View