摘要:
#include#include#includeusing namespace std;/* 4.4.2 类做友元*/class Building; // 声明Building类,后续会写,防止Goodgay类中引用时报错class Goodgay{pu... 阅读全文
posted @ 2021-03-16 14:48
yub4by
阅读(43)
评论(0)
推荐(0)
摘要:
#include#include#includeusing namespace std;/* 4.4 友元 让一个函数或类可以访问另一个类中的私有成员 关键字friend 三种实现: 全局函... 阅读全文
posted @ 2021-03-16 14:47
yub4by
阅读(65)
评论(0)
推荐(0)
摘要:
#include#include#includeusing namespace std;/* 4.3.4 const修饰成员函数 常函数:成员函数后加const(修饰的是this指针,令指针指向的值也不可修改) 常函数... 阅读全文
posted @ 2021-03-16 12:10
yub4by
阅读(25)
评论(0)
推荐(0)
摘要:
#include#include#includeusing namespace std;/* 4.3.3 空指针访问成员函数 C++中空指针是可以调用成员函数的 但是注意有没有用到this指针(有坑) 若用到了t... 阅读全文
posted @ 2021-03-16 12:09
yub4by
阅读(40)
评论(0)
推荐(0)