1.

What is the output of this program?
#include 
using namespace std;
class Example
{
public:
int m, n;
Example() {};
Example(int, int);
Example operator + (Example);
};
Example::Example (int p, int q)
{
m = p;
n = q;
}
Example Example::operator+ (Example parameter)
{
Example container;
container.m = m + parameter.m;
container.n = n + parameter.n;
return (container);
}
int main ()
{
Example p (3,4);
Example q (6,5);
Example R;
R = p + q;
cout << R.m << "," << R.n;
return 0;
}

A. 9,9
B. 3,4
C. 6,5
D. Compilation Error
E. None of these
Answer» B. 3,4


Discussion

No Comment Found

Related MCQs