-
What is the output of this program?
#include <iostream>
using namespace std;
struct N
{
private:
int p, q, s;
public:
int fun1();
void fun2();
};
int N :: fun1()
{
return p + q + s;
}
void N :: fun2()
{
p = q = s = 0;
}
class M
{
int p, q, s;
public:
int fun1();
void fun2();
};
int M :: fun1()
{
return p + q + s;
}
void M :: fun2()
{
p = q = s = 0;
}
int main()
{
N obj1;
M obj2;
obj1.fun1();
obj1.fun2();
obj2.fun1();
obj2.fun2();
cout << "Identical results...";
}
-
- Compilation Error
- Runtime Error
- Garbage value
- Identical results...
- None of these
Correct Option: D
In this program, We apply the access specifiers to both the class and the structure.