...

/

Inheritance

Inheritance

Learn about one of the most important topics in OOP: inheritance.

Overview

Inheritance is a fundamental concept of object-oriented programming. With inheritance, one class can inherit the functionality of another class. In other words, it allows programmers to encapsulate some common functionality in a base class, while more specific functionality will be implemented in child classes.

The best way to understand inheritance is to see it in action.

Let’s take a Car class as an example:

public class Car
{
	public string Model { get; set; }
	public decimal Price { get; set; }
	public int Year { get; set; }
	public int FuelCapacityInLiters { get; set; }
	public int FuelLeft { get; set; }

	public void Drive()
	{
	}
}
...