The actual mean of polymorphism word is having many forms. Into OOPs(object-oriented programming) paradigm, polymorphism is often expressed as 'one interface, multiple functions'.
- Static Polymorphism
- Dynamic Polymorphism
Static Polymorphism
The technique of linking a function with an object during compile time is called early binding. This is also called static binding. C# provides two techniques to implement static polymorphism. They are −
- Function overloading
- Operator overloading
Dynamic Polymorphism
C sharp allows you to create abstract classes that are used to provide partial class implementation of an interface. Where the Implementation is completed when a derived class inherits from it. Because, the AbstractClasses contain abstract methods, which are implemented by the derived class. So, the derived classes have more specialized functionality.
Here are the rules about abstract classes −
- We cannot create an instance of an abstract class
- We cannot declare an abstract method outside an abstract class
When a class is declared sealed, it cannot be inherited, abstract classes cannot be declared sealed.