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 subquestions. Note that some private and protected data members as well as function definitions ie bodies are omitted for
class Vehicle private:
int capacity;
public:
Vehicle int capacity thiscapacity capacity; void move double distance
class Car: public Vehicle
public:
Car int capacity : Vehicle capacity void move double distance
int main
Vehicle
vehicle new Car ;
vehiclemove : line
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
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 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
