Implement inheritance and polymorphism

At a glance

Learn how to create class hierarchies using base and derived classes and how to implement polymorphic behavior by using either class inheritance or interface implementation.

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 an object-oriented program written in C#.

Modules in this learning path

Learn how to create a class hierarchy using base and derived classes and how to hide or override members of a derived class by using new, virtual, abstract, and override keywords.  

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.