C++技术日记
yiluxiangbeinwu
这个作者很懒,什么都没留下…
展开
-
error redefinition of 'xxx' 问题解决
error redefinition of 'xxx'出现这种问题:1. .H文件没有进行#ifndef。。。 #define。。。 。。。。。 #endif这种限制。原创 2017-04-11 20:59:48 · 17477 阅读 · 0 评论 -
构造函数初始化列表
构造函数用初始化列表,显示初始化非静态成员变量;避免忘记初始化; 1 #include 2 using namespace std; 3 4 class list1{ 5 public: 6 list1(int a,int b): 7 mInta(a),mIntb(b) 8 { 9 cout 1原创 2017-04-03 19:35:41 · 230 阅读 · 0 评论 -
拷贝构造函数1.0
1 #include 2 #include 3 4 using namespace std; 5 6 class callwitch{ 7 private: 8 string name; 9 static int o原创 2017-04-03 21:50:53 · 162 阅读 · 0 评论 -
enum注意事项
enum的本质其实是,定义一种只能设定特定值的数据类型。同时enum在声明的时候,是在为数据项赋值。但是这个赋值的过程并没有生成新的数据对象,只是用数据替换掉标变量的名称。enum class(struct) name{aaa = 1,bbb = 2}这种需要确定作用范围的enum。1. 不能隐士的转换成int类型 (可以进行显示的类型转换)2.原创 2017-05-03 22:20:10 · 234 阅读 · 0 评论