Multi-Level Inheritance With Overrides
mediumQuestion 143You are given a base class Vehicle with a protected int speed and a virtual function describe().
An intermediate class Car has been partially provided: it inherits from Vehicle and adds a protected int doors member.
Your tasks:
1. Implement the Car constructor (takes speed and doors, calls Vehicle base constructor)
2. Create a class SportsCar that inherits from Car
- Has a private bool turbo member
- Has a constructor taking speed, doors, and turbo
- Overrides describe() to print:
Speed: [speed]
Doors: [doors]
Turbo: [yes/no]
Do NOT include a main function. Your code will be tested automatically.
Expected output
Speed: 200 Doors: 2 Turbo: yes
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
ClassesInheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.