05 2020 档案

摘要:使用const Complex operator + (const Complex &c ) const {} 重新定义类的+操作 #include<iostream> using namespace std; class Complex{ public: Complex(int r, int i) 阅读全文
posted @ 2020-05-15 23:44 c语言我的最爱 阅读(1560) 评论(0) 推荐(0) 编辑
摘要:使用void(Student::*pwho) void = & Student::who // 构造函数指针 使用string Student::*p_name = & Student::m_name //构造变量指针 #include <iostream> #include <cstdio> us 阅读全文
posted @ 2020-05-15 23:30 c语言我的最爱 阅读(603) 评论(0) 推荐(0) 编辑
摘要:饿汉式声明, 一开始的时候对单例进行声明 #include <iostream> using namespace std; class Singleton{ public: static Singleton& getInstance(void){ return s_instance; } void 阅读全文
posted @ 2020-05-10 23:50 c语言我的最爱 阅读(249) 评论(0) 推荐(0) 编辑
摘要:静态变量 使用static 来定义变量,可以被全局的类使用,不需要声明就能调用,属于类成员,不属于对象成员 #include <iostream> using namespace std; class A{ public: //普通成员变量在构造时定义和初始化 A(int data = 0):m_d 阅读全文
posted @ 2020-05-10 21:34 c语言我的最爱 阅读(1134) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示