Q. | What is the output of this program? #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;
}
|
|||||||
|
Answer: | Option D | |
Explaination: | In this program, we are finding a value from the given function by using the friend for compute function. |
Discussion
Your Comments Goes here... |
Name | Discussion |
---|