Overloading and Overriding both are example of polymorphism. Overriding is dynamic polymorphism while overloading is static polymorphism.
Overriding: Overriding is a changing of behavior of a class in drive class using dynamic polymorphism. for example in C# you have a class A and another class B drive from A. Class A have a virtual method abc and in class B using override you given new functionality to this method.
Overloading: Overloading is a mechanism by which we can have two different methods using same name.
Overloading can be implemented using Different parameter data types, different number of parameters, different order of parameters.
No comments:
Post a Comment