mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-03 18:43:52 +08:00
25 lines
255 B
C++
25 lines
255 B
C++
#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;
|
|
}
|