...
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024
OOPS
August 29, 2024

OOPS

Question 19
What is the output of the following program:

#include

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;

}

Main ( )

{

Sample e;

e.test( );

Cout < < compute(e);

}

A
205
B
300
C
295
D
error
Correct Answer: C
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!