Explain Polymorphism in C#?
- Programmatically, Polymorphism means same method but different implementations.
- It is of 2 types, Compile-time and Runtime.
- Compile time polymorphism is achieved by operator overloading.
- Runtime polymorphism is achieved by overriding. Inheritance and Virtual functions are used during Runtime Polymorphism.
- For Example, If a class has a method Void Add(), polymorphism is achieved by Overloading the method, that is, void Add(int a, int b), void Add(int add) are all overloaded methods.
No comments