Implementing polymorphism

Polymorphism is a concept that is quite easy to grasp once you have looked at and understood the other pillars of OOP. Polymorphism literally means that something can have many forms. This means that from a single interface, you can create multiple implementations thereof.

There are two subsections to this, namely, static and dynamic polymorphism. With static polymorphism, you are dealing with the overloading of methods and functions. You can use the same method, but perform many different tasks.

With dynamic polymorphism, you are dealing with the creation and implementation of abstract classes. These abstract classes act as a blueprint that tells you what a derived class should implement. The following section looks ...

Get C# 7 and .NET Core Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.