Function Call

Q.

What is the output of this program?

1.
    #include 
2.
    using namespace std;
3.
    class three_d 
4.
    {
5.
        int x, y, z;
6.
        public:
7.
        three_d() { x = y = z = 0; }
8.
        three_d(int i, int j, int k) { x = i; y = j; z = k; }
9.
        three_d operator()(three_d obj);
10.
        three_d operator()(int a, int b, int c);
11.
        friend ostream &operator<<(ostream &strm, 
        three_d op);
12.
    };
13.
    three_d three_d::operator()(three_d obj)
14.
    {
15.
        three_d temp;
16.
        temp.x = (x + obj.x) / 2;
17.
        temp.y = (y + obj.y) / 2;
18.
        temp.z = (z + obj.z) / 2;
19.
        return temp;
20.
    }
21.
    three_d three_d::operator()(int a, int b, int c)
22.
    {
23.
        three_d temp;
24.
        temp.x = x + a;
25.
        temp.y = y + b;
26.
        temp.z = z + c;
27.
        return temp;
28.
    }
29.
        ostream &operator<<(ostream &strm, three_d op) {
30.
        strm << op.x << ", " << op.y << ", " << op.z << endl;
31.
        return strm;
32.        
    }
33.
    int main()
34.
    {
35.
        three_d objA(1, 2, 3), objB(10, 10, 10), objC;
36.
        objC = objA(objB(100, 200, 300));
37.
        cout << objC;
38.
        return 0;
39.
    }
A. 55, 106, 156
B. 55, 106
C. 55, 106, 159
D. none of the mentioned

Answer : Option A

Explanation :

In this program, We are using the function call operator to calculate the value of objc.
Output:
$ g++ call2.cpp
$ a.out
55, 106, 156