Implement class inheritance
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.
Learning objectives
Describe the principles of class inheritance.
Configure base and derived classes.
Hide the members of a base class by using the
new
keyword.Override the members of a base class by using the
virtual
,override
, andabstract
keywords.Access the members of a base class from within a derived class.
Implement a class hierarchy in a C# app by using base and derived classes.
Add
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#.