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

Showing Answers 1 - 1 of 1 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 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 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