Search⌘ K

Base Keyword

Explore the use of the base keyword in C# to access members of a base class from an immediate derived class. Understand how to reference base class fields, call base class methods, and invoke base class constructors within derived classes. This lesson helps you effectively implement inheritance by managing member access and constructor chaining.

What Is the base Keyword?

As you already know, the this keyword in C# is used to refer to the instance of the current class.

In a similar fashion, the base keyword in C# is used to refer to the base class members from inside the immediate derived class. The use of base comes into play when we implement inheritance.

Use Cases of the base Keyword

The base keyword is used in three major contexts:

Accessing Base Class Fields

The base keyword can be used to access any non-private fields of the base class directly from the derived class. The base keyword followed by the dot ...