The Factory Method Pattern - Exercise
Write an abstract Vehicle class. In this exercise, you willl write an abstract Vehicle class that has the structure shown in this diagram:
When working with C++, overload the
operator instead of using a
methods should be used to change the speed. However, they are subject to the constraints that the speed is always greater than or equal to zero and less than or equal to
. Attempts to increase speed above
or decrease it below 0 should simply pin the speed to the boundaries.
Note that this class is quite general and can actually describe pedestrians as well.
In the text area below, type or paste your answer.
button to submit the factory method exercise.