Further, I have a query regarding design
Problem Statement:-
I have subcategories defined under Vehicle Class as :- Bike ,Car, truck, bus
Further, there are different variants under each four categories
Bike :- sport, standard Car :- sport, standard, electric Truck :- Mini Truck , Power Truck Bus:- Mini Bus, AC Bus
I have to calculate the price based on variants. For example Mini Bus price.
Question:- How should I define the classes ?
- Keep only vehicle as a class .
- Keep Vehicle as a base class and make bike, car, truck , bus as subclasses and they should inherit the base class.
- make sports bike as class which will inherit bike class which will further inherit vehicle class
What is the best possible solution following OOPS and Solid.
Aucun commentaire:
Enregistrer un commentaire