Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming 100 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
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

Answer: Option C