Question: 1. write definitions for the member functions and constructors in the following class. class Car { string brand; // ex BMW int year; Car(); //

1. write definitions for the member functions and constructors in the following class.

class Car {

string brand; // ex BMW

int year;

Car(); // assign some default values for brand and year.

Car(string, int);

string getBrand();

int getyear();

void setBrand(string);

void setYear(int);

2. In the main function declare two objects of type car, the first object should be initialized using the default constructor, while the second object should be initialized using the non-default constructor. Print the values of the private data members for each object using the accessor functions.

3. Change the values of the private data members for the previous objects using the mutator functions, and then print these new values using the accessor functions.

4. Declare a third object of type Car and initialize it using the default constructor.

5. Declare a pointer of type Car, initialize this pointer to point to the third object you created in the previous step. Print the data members of the third object using the pointer.

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!