Implement polymorphic behavior
Learn the principles of polymorphism, how to implement polymorphic behavior by using either class inheritance or interface implementation, and how to choose between inheritance-based and interface-based approaches to polymorphism.
Learning objectives
Describe the principles of polymorphism.
Implement inheritance-based polymorphism.
Implement interface-based polymorphism.
Explain polymorphic design considerations.
Implement polymorphic behavior in a C# application.
Prerequisites
An installation of Visual Studio Code with the C# Dev Kit extension installed.
The ability to develop basic object-oriented program in C# that implement classes with properties and methods.
The ability to create interfaces that define a contract for the classes implemented by a basic object-oriented program written in C#.
The ability to create a class hierarchy by using base and derived classes.