Inheritance:

  • It allows a class (subclass) to inherit attributes and methods from another class (superclass).
  • Example: A class Car can inherit from a class Vehicle, inheriting attributes like color and speed, and methods like accelerate().

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *