Class Inheritance

Let's learn about class inheritance.

What’s inheritance?

Classes can inherit all class features from another class using inheritance. With class inheritance, the derived class acquires all of the features from the base class. C# only supports single inheritance, meaning that it can only inherit one class at a time.

Syntax

public class ASecondClass : TheFirstClass
{ 
  // ASecondClass inherits all the features from the base class TheFirstClass 
}

Example

Get hands-on with 1200+ tech skills courses.