What is the overriding and overloading in C# with example?
1590
17-Sep-2016
Abhishek Srivasatava
17-Sep-2016Overloading: This concept is useful when we need the function / method of the same name but different signature or parameter or type. It is the example of compile time polymorphism.
Example
Overriding: Concept for the overriding is useful when we need a method / function of the same name, parameter, type and the signature which is defined in base and derived class. The advantage of this is that memory will allocate only for one method/function. It is the example of Dynamic time polymorphism.
It can be done by using the keyword Virtual (before the function name define in base class) and override (before the function name define in derived class)