Computer Science, asked by nasreenc28851, 11 months ago

Difference b/w method overloading and constructor overloading

Answers

Answered by GOPINTR
3
Overloaded methods may havedifferent return types. When java encounters a call to anoverloaded method, it simply executes the version of themethod whose parameters match the arguments used in the call.Constructors having the same name with different parameter list is called constructor overloading.

GOPINTR: hai
Answered by phillipinestest
4

No clear reference has been provided in the question. So, I am going to provide the answer to this question in reference to Java programming language.

Constructor overloading is a special case of having two or more constructors with the same name (obviously) but different parameter declarations. And different constructor is executed according to the values passed as actual parameters during the process of instantiation.

Method overloading is also similar to constructor overloading.

But in this there are two or more functions in a class with the same name but different parameter declarations and different functions are called according to the actual parameters passed during the function calling.

Similar questions