update dir

This commit is contained in:
light-city
2019-08-06 15:30:17 +08:00
parent 71d83ce466
commit f1e2b3fbef
7 changed files with 164 additions and 1 deletions

28
friend/friend_class.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;
class A
{
public:
A(int _a):a(_a){};
friend class B;
private:
int a;
};
class B
{
public:
int getb(A ca) {
return ca.a;
};
};
int main()
{
A a(3);
B b;
cout<<b.getb(a)<<endl;
return 0;
}