Question: Considering the following implementation, what is the missing line? class Test { private: int x; int y; public: Test (int x = 0, int

Considering the following implementation, what is the missing line? class Test { private: int x; int y;

Considering the following implementation, what is the missing line? class Test { private: int x; int y; public: Test (int x = 0, int y = 0) { this->x = x; this->y = y; } Test* setX(int a) { x = a; return this; } Test setY(int b) { y = b; return this; } void print() { cout < < "x = " < < x < < y " }; int main() } Test obj1(5, 5); // MISSING LINE obj1.print(); return 0; < < y < < endl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The missing line in the code should be a call to the setX or setY member functions o... 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 Programming Questions!