Question: Write a definition of a class (called Vehicle), which has three data members: model (data type: string), price (data type: double), crashRating (data type; int).

Write a definition of a class (called Vehicle), which has three data members:
  1. model (data type: string),
  2. price (data type: double),
  3. crashRating (data type; int).
  4. All data should be public.
b) With the definition in above , write code to create three instances of the class Vehicle v1, v2, and v3. Set the model to “Mustang”, “Camaro”, and “Charger” respectively
c) Allocate a new Vehicle object, assign it using v2, print the brand, and free the allocation.

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Here is the definition of the class Vehicle with the three data members cpp c... View full answer

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 Operating System Questions!