Imagine you are developing an e-commerce system where different types of users (Admin, Buyer, and Seller) exist. Which inheritance model might be beneficial to maintain, expand, and utilize polymorphic behavior? 

  • Single Inheritance 
  • Multiple Inheritance 
  • Hierarchical Inheritance 
  • Hybrid Inheritance
Hierarchical inheritance is where a single class serves as a base class (superclass) for more than one derived class (subclass). In this scenario, the common attributes and methods of users can be part of the base class, while unique functionalities for Admin, Buyer, and Seller can be defined in their respective derived classes.
Add your answer
Loading...

Leave a comment

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