0Pricing
C# Academy · Lesson

Inheritance: Reusing Code

Reuse and extend existing code using inheritance in C#.

1

Inheritance: Reusing Code

Welcome to the next lesson! In this lesson, you’ll learn about inheritance, one of the core principles of Object-Oriented Programming, and how it enables you to reuse code and build hierarchies. Let’s get started!

Inheritance: Reusing Code — illustration 1

2

What is Inheritance?

Inheritance allows one class (the child or derived class) to acquire the attributes and methods of another class (the parent or base class). It enables code reuse and hierarchical class relationships.

Example: A "Car" class could serve as a base class for "ElectricCar" and "SportsCar" classes, sharing common properties like "Color" and "Speed."

All lessons in this course

  1. What is Object-Oriented Programming?
  2. Defining Classes and Objects
  3. Understanding Properties and Methods
  4. Constructors in C#
  5. Encapsulation and Access Modifiers
  6. Inheritance: Reusing Code
  7. Polymorphism and Method Overriding
← Back to C# Academy