Search⌘ K
AI Features

The Syntax and Terminologies

Explore the fundamental syntax and terms of inheritance in C#. Understand the roles of base and derived classes, access modifiers including protected, and how to implement inheritance using practical examples with a vending machine project.

The Terminologies

Since we know that a new class is created based on an existing class in inheritance, we use the terminology below for the new class and the existing class:

  • Base Class (Mother Class or Superclass): This class allows the re-use of its non-private members in another class.
  • Derived Class (Child Class or Subclass): This class is the one that inherits from the superclass.

A child class has all non-private characteristics of the mother class.

What Does a Child have?

An object of the child class can use:

  • All members defined in the child class.
  • All non-private members defined in the mother class.
...