Question: What is the appropriate output for the following program? (C++) class point { private: float x,y; public: point(); point(float,float); float getx() { return x; };

What is the appropriate output for the following program? (C++)

class point { private: float x,y; public: point(); point(float,float); float getx() { return x; }; float gety() { return y; }; point operator+(point p2); }; point::point() { x = 0; y = 0; } point::point(float _x, float _y) { x = _x; y = _y; } point point::operator+(point p2) { point temp(x - p2.x, y - p2.y); return temp; } int main() { point a(3,4), b(2,2), c; c = a + b; cout << "c = (" << c.getx() << "," << c.gety() << ") "; return 0; }

A.) c = (5,6)

B.) c = (0,0)

C.) c = (6,8)

D.) c = (1,2)

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!