CJCoding With Joseph
15per day

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

Expected Output:

Speed: 120
Doors: 4
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.