BZ易风

导航

 

2021年8月19日

摘要: class Person { Person() //构造 { } //可以重载和有参 ~Person() //析构 { } } 构造函数 与类名相同,不用写void 分类 参数分类:无参构造函数 有参构造函数 类型分类:普通构造函数 拷贝构造函数 #include <iostream> using 阅读全文
posted @ 2021-08-19 17:25 BZ易风 阅读(46) 评论(0) 推荐(0) 编辑
 
摘要: #include <iostream> using namespace std; class Cube { public: void SetL(int l) { m_L = l; } int GetL() const //只有用const修饰的方法,compareCube才能用const做形参 { 阅读全文
posted @ 2021-08-19 16:30 BZ易风 阅读(34) 评论(0) 推荐(0) 编辑
 
摘要: class 成员默认权限是private struct 成员默认权限是public 阅读全文
posted @ 2021-08-19 15:35 BZ易风 阅读(38) 评论(0) 推荐(0) 编辑
 
摘要: C语言封装 属性和行为分开处理了,类型检测不够 typedef struct _Person{ char name[64]; int age; }Person; typedef struct _Aninal{ char name[64]; int age; int type; //动物种类 }Ain 阅读全文
posted @ 2021-08-19 15:01 BZ易风 阅读(26) 评论(0) 推荐(0) 编辑
 
摘要: 编辑器为了实现重载函数,用不同类型来修饰不同的函数名,比如 void func(); 编辑器会修饰成_func 碰到void func(int x),编辑器会修饰成_func_int 碰到void func(int x , char c),可能就会修饰成_func_int_char 阅读全文
posted @ 2021-08-19 11:23 BZ易风 阅读(52) 评论(0) 推荐(0) 编辑