cpp
#include<iostream>
using namespace std;
class Building;
class Gooddey{
public:
friend Building;
Gooddey();
void visit();
Building *building;
};
class Building{
friend class Gooddey;
public:
Building(){
this->age = 10;
this->ac = 20;
}
public:
int age ;
private:
int ac ;
};
Gooddey::Gooddey(){
building = new Building;
}
void Gooddey::visit(){
cout << building->age << endl;
cout << building->ac << endl;
}
void test(){
Gooddey p;
p.visit();
}
int main(){
test();
}