You are designing a system where various types of vehicles (like cars, bicycles, trucks) share common properties and behaviors but also have unique attributes. Which OOP principle would be most beneficial in this scenario?

  • Encapsulation
  • Inheritance
  • Abstraction
  • Polymorphism
Abstraction allows you to define common behaviors and attributes in a base class, while leaving the specific implementations to the derived classes. This fits well with the scenario described.
Add your answer
Loading...

Leave a comment

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