Question
Create a class called Skateboard. Add two member variables color and size. Add only getter functions. Implement a constructor that expects values for both variables
Create a class called Skateboard. Add two member variables color and size. Add only getter functions. Implement a constructor that expects values for both variables and assigns them.
Create a class Motor with a single member variable named speed. Add a getter function and a constructor that expects a value for speed and assigns it.
Create a subclass of Skateboard named ElectronicSkateboards. The class uses composition by having a single instance of Motor. Add a constructor which expects color, size and an motor object. Pass color and size to the base constructor and set motor to its member variable.
write this in C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started