Question: C++ PLEASE I NEED HELP IN THIS QUESTION Complete the skeleton of the following class: class B { int a, b, c; public: B( )

C++

PLEASE I NEED HELP IN THIS QUESTION

Complete the skeleton of the following class:

class B

{

int a, b, c;

public:

B( ) {.} // set a = 0, b=0, c=0

B(int x, int y, int z) { } // set a=x, b=y, c=z

B(const A & x) { }; // copy constructor

B & operator = (A & x) { }; // overloading = operator

print( ) { // print out the values of a, b, c }

};

Write a main routine in which you have the following statements:

int main( )

{

// statement 1

B x;

// print out the content of x

// statement 2

B y(2, 3, 4);

// print out the content of y

// statement 3

B z(y);

// print out the content of z

// statement 4

B w = z;

// print out the content of w

// statement 5

B v;

// print out the content of v

// statement 6

v = w;

// print out the content of v

return 0;

}

Explain which member function of class B is called for each of the above 6 statements. Write some statements to print out the values of data members of objects x, y, z, w, and v. You may need to present the results via a screenshot.

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!