CJCoding With Joseph
15free / daySign inCreate account

Multi-Level Inheritance With Overrides

You 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 — print one after the last line.

Hints4 available
Topics:
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.