As we refine a Class Model, one thing to consider is changing the 'location' of attributes through inheritance. Many of
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
As we refine a Class Model, one thing to consider is changing the 'location' of attributes through inheritance. Many of
As we refine a Class Model, one thing to consider is changing the 'location' of attributes through inheritance. Many of the classes have attributes, and some attribute values are shared among multiple classes. When all subclasses have a particular attribute in common, we might move this attribute to the superclass. Considering our Restaurant example, which of the attributes listed below would be good candidates for raising to a superclass? Select all that apply. Note: there is a negative score for selecting an attribute that should not be raised. Payment Customer Order Item BeefBurger amount number quantity:int doubleBeef:bool total() = number cheese:bool cost() = number Change Employee cost = number amount number Burger Chicken Burger Cashier GrillCook cost() = number cheese:bool greenChili:bool Fries costo = number size:int FryCook Server Soda cost() = number size:int flavor string Beverage cost() = number Manager BeverageCook cost() = number Shake flavor string cost() = number doubleBeef quantity size greenChili flavor cheese
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!