Answers for "friend class and friend function"

5

uninstall nginx

sudo apt-get purge nginx nginx-common
Posted by: Guest on November-14-2020
1

remove nginx

sudo apt-get remove nginx* --purge
Posted by: Guest on November-29-2020
0

friend class and friend function

class A{
 private:
  int data_a;
 public:
  A(int x){
   data_a=x;
  }
  friend int fun(A, B);
}
class B{
 private:
  int data_b;
 public:
  A(int x){
   data_b=x;
  }
  friend int fun(A, B);
}
int fun(A a, B b){
 return a.data_a+b.data_b;
}
int main(){
 A a(10);
 B b(20);
 cout<<fun(a,b)<<endl;
 return 0;
}
Posted by: Guest on October-29-2021

Code answers related to "friend class and friend function"

Browse Popular Code Answers by Language