Vidyalelo
C++ Programming · Q229

Classes and Objects in C++

Programming · C++ Programming · question 229

Q229

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

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board