Method Overloading | Method Overriding |
---|---|
It’s an approach defining multiple methods with the same name and different signatures. | It's an approach of defining multiple methods with the same name and same signature. |
This can be done either within the same class or between parent and child classes. | This can be done only between parent and child classes. |
To overload parent’s method under child class child class does not require to take any permission from its parent class. | To override parent’s classes method under child class child class should take an explicit permission from it parent class. |
This is all about defining multiple behaviors to a method. | This is all about changing the behaviors of a method between parent and child classes. |
Difference between method overloading and method overriding
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment