Overloading is a way of using the same method name


Q - Overloading is a way of using the same method name for multiple methods as long as the number / types of arguments are different. Why is overloading useful? Give an example (other than the one in the lecture notes or book) of how this could be used.

A - Overloading is useful by simply keeping method names simple with less confusion. There is no need for crazy titles with certain capitalized letters and so on. You can use the same name, but use different parameters.

i.e. Overloaded Constructor ( Hopefully this example is correct)

public void setCat(String name, int age, double weight)
{
this.name = name;
this.age = age;
this.weight = weight;
}

Criteria - Write one or two paragraphs. Provide valuable and thoughtful feedback for the above answer with constructive criticism and critiques. Present original thoughts and ideas in postings, (avoid simple agreement or disagreement with, or restatement of other's postings) You may want to provide additional information from your outside readings or other outside resources. I encourage you to share links to other excellent resources during this course.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Overloading is a way of using the same method name
Reference No:- TGS0123811

Expected delivery within 24 Hours