Question: Use the following code to answer the following 2 sub - questions. Note that some private and protected data members as well as function definitions

Use the following code to answer the following 2 sub-questions. Note that some private and protected data members as well as function definitions (i.e., bodies) are omitted for
class Vehicle ( private:
int capacity;
public:
Vehicle (int capacity)( this->capacity = capacity; void move (double distance)(..)
17
class Car: public Vehicle (
public:
Car (int capacity) : Vehicle (capacity)() void move (double distance)(...)
int main)
Vehicle
* vehicle = new Car (5) ;
vehicle-move (10.0): //line 2
When the main function is executed in the code above, line & will call the move function of which of the following classes?
Vehicle
Car
None
Both Car and Vehicle
1 point
Using the code snippet from the prior question, answer:
If the virtual keyword is used in the declaration of the move function in class Vehicle, line 2 will call the move function of which of the following classes?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!