Design a class for car inventory . For every new car from the manufacturer there should be minimal changes to the code.

Showing Answers 1 - 3 of 3 Answers

if you want to do minimal change always go for polymorphic classes..
first find the services you need ...& designa interface class that contain all methods
virtual....now we can have different cars..
so derive yr inventory class for each car from this interface


now tha benifit is this...that this design is extendible..we can add n no: of classes as child class .....may be in future we  will get some other requirement....so we can add the class for that as the child class to the interface no need to changer the interface
or client code(main())

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions