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!

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."