When is a method said to be overloaded and when is a method said to be overridden?
Method Overloading :
1. Overloading deals with multiple methods in the same class with the same name but different method signatures.
2. Overloading lets us define the same operation in different ways for different data.
Method Overriding :
1. Overriding deals with two methods, one in the parent class and the other one in the child class and has the same name and signatures.
2. Overriding lets you define the same operation in different ways for different object types.
0 Comments:
Post a Comment
<< Home