Challenge 1: Implement the Derived Class

Can you implement the Derived Class Function by using the Base Class functions? A solution is placed in the "solution" section to help you, but we would suggest you try to solve it on your own first.

Problem Statement

Implement a function getDetails(string carName) of the Derived Class Car which takes a string carName and append it with model name and speed. We have already implemented the Base Class Vehicle with the member functions ‘getModel()’ and `getSpeed()’ which return the model and speed of the car respectively.

Input

Car Name

Output

Car Name, Model, Speed

Sample Input

"Roadster"

Sample Output

"Roadster, Tesla, 100" 

Get hands-on with 1400+ tech skills courses.