Answer:
No,we can not define Method Overloading in different classes.It must be on the same class.
As we know that Function Overloading is defined in the same class.
We can understand it by an example:-
Below function are an example of Overloaded Constructor,which are defined on the same class.
public class Person
{
public Person()
{
}
public Person(int person_id)
{
}
}
If we define same function in different classes,so they will not be called as function overloading.
Asked In: Many Interviews |
Alert Moderator