Q. What will be output for the followiing code?
Code:
#include <iostream>
class A {
private:
int a;
public:
A() { a = 0; }
friend class B; // Friend Class
};
class B {
private:
int b;
public:
void showA(A& x)
{
std::cout << ""A::a="" << x.a;
}
};
int main()
{
A a;
B b;
b.showA(a);
}
β
Correct Answer: (D)
A::a=0