1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #if(0)
- #include <iostream>
- class Building;
- class GoodGay
- {
- public:
- GoodGay();
- void visit();
-
- Building* building;
- };
- class Building
- {
-
- friend class GoodGay;
- public:
- Building();
- public:
- std::string m_SittingRoom;
- private:
- std::string m_BedRoom;
- };
- Building::Building()
- {
- m_SittingRoom = "客厅";
- m_BedRoom = "卧室";
- }
- GoodGay::GoodGay()
- {
-
- building = new Building;
- }
- void GoodGay::visit()
- {
- std::cout << "好基友类正在访问:" << building->m_SittingRoom << std::endl;
- std::cout << "好基友类正在访问:" << building->m_BedRoom << std::endl;
- }
- void test01()
- {
- GoodGay gg;
- gg.visit();
- }
- int main()
- {
- test01();
- system("pause");
- return 0;
- }
- #endif
|