What is Static/Dynamic Polymorphism in C#?

Static Polymorphism in C# is what allows you to bind multiple methods or operators, in essence you can create multiple methods or operators using the Overloaded keyword with the same name to handle or process different types of arguments uniquely.

void MyMethod(int x) { }
void MyMethod(float x) { }
void MyMethod(double x, double y) { }

Now a good example of Dynamic Polymorphism was applied to my post about the base keyword in C# available here using the virtual/override techniques.

Inheritance facilities Dynamic Polymorphism, by having the virtual/override keywords attached to the method/operator in the child class, the new functionality of that method will now be used for that child class.

No Comments Yet