1.

What will be the output of the following program?

#include<iostream.h> class Point
{ int x, y; public: Point(int xx = 10, int yy = 20) { x = xx; y = yy; } Point operator + (Point objPoint) { Point objTmp; objTmp.x = objPoint.x + this->x; objTmp.y = objPoint.y + this->y; return objTmp; } void Display(void) { cout<< x << " " << y; }
};
int main()
{ Point objP1; Point objP2(1, 2); Point objP3 = objP1 + objP2; objP3.Display(); return 0; }

A. 1 2
B. 10 20
C. 11 22
D. Garbage Garbage
E. The program will report compile time error.
Answer» D. Garbage Garbage


Discussion

No Comment Found

Related MCQs