Junior OOP

What is inheritance?

  • Inheritance is an OOP mechanism where a class (derived/child) inherits

properties and methods from another class (base/parent).

  • Promotes code reusability and hierarchical relationships.

class Vehicle { public void Start() => Console.WriteLine("Vehicle

started"); }

class Car : Vehicle { } // Car inherits from Vehicle

More from C# Programming Tutorial

All questions for this course