Home / MCQ Bank / Computer
Computer Classes And Objects In C Plus Plus Difficulty: Medium

What will be the output of the following C++ code? #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; }

Select the correct option to test your answer:

More Computer Questions

Which version of PHP introduced the advanced concepts of OOP? What is the primary goal of Information Retrieval in NLP? A random-access data storage device which gives rapid access to data is Internet-like networks within an enterprise. Which of these method is used to tell the calling thread to give up a monitor and go to sleep until some other thread enters the same monitor?