R

Ram Sharma • 193.86K Points
Coach

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); 
  
 }
  • (A) A::0
  • (B) a=0
  • (C) A
  • (D) A::a=0

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.