Here is a very important difference which leads to confusion for many new programmers:
1) Method Overloading: In the same class, we have two methods with the same name but with different parameters.
2) Method Overriding: In the sub-class, we have a method with the same name as in parent class and with the same parameters. This is usually done to have a different functionality in the sub-class.
1) Method Overloading: In the same class, we have two methods with the same name but with different parameters.
2) Method Overriding: In the sub-class, we have a method with the same name as in parent class and with the same parameters. This is usually done to have a different functionality in the sub-class.
No comments:
Post a Comment