Question: Task 1 : Create the Motorcycle class by deriving it from the Vehicle class. Use a public derivation. In the Motorcycle class, create a private
Task : Create the Motorcycle class by deriving it from the Vehicle class. Use a public derivation.
In the Motorcycle class, create a private attribi named sidecar. The sidecar attribute should data type bool.
Task : Write a public set and get methods for the sidecar attribute.
Task : Write a public accelerate method. This method overrides the accelerate method inherited from the Vehicle class. Change the message in the accelerate method so the following is displayed when the Motorcycle tries to accelerate beyond its maximum speed: "This motorcycle cannot go that fast".
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
