CJCoding With Joseph
15free / daySign inCreate account

Constructor Call Order

A base class Vehicle has been provided with a protected int speed and a constructor that sets it.

A derived class Car publicly inherits from Vehicle and has an additional int member doors. The Car constructor has been declared but not implemented.

Your task is to implement the Car constructor using an initialization list. It must call the Vehicle base constructor to set speed, and also initialize doors.

Do NOT include a main function. Your code will be tested automatically.

Expected Output:

Speed: 120
Doors: 4

= newline. The output ends with a newline — print one after the last line.

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