adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    class sample
    {
        private:
        int a, b;
        public:
        void test()
        {
            a = 100;
            b = 200;
        }
        friend int compute(sample e1);
    };
    int compute(sample e1)
    {
        return int(e1.a + e1.b) - 5;
    }
    int main()
    {
        sample e;
        e.test();
        cout  << compute(e);
        return 0;
    }

a.

100

b.

200

c.

300

d.

295

Answer: (d).295

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?