摘要: 1. 面向对象小例子 下面是经常写的, 高级封装, 把类进行拆分, 类和方法分开的形式 // 目录和文件都小写, 重要的事情才大写 // 类的名字首字母大写 #include <iostream> #include <string> #include "Per.h" Person::Person() 阅读全文
posted @ 2018-06-11 14:55 我当道士那儿些年 阅读(279) 评论(0) 推荐(0)
摘要: std::bad_alloc& e 相当于python的execpt Exption as e 例子二 阅读全文
posted @ 2018-06-11 10:23 我当道士那儿些年 阅读(127) 评论(0) 推荐(0)
摘要: #include using namespace std; /* 模板的作用: 1. 不用声明类型, 传什么进来就是什么类型, 返回也是什么类型 2. 方法封装起来, 可以当公共类使用, 方便 */ template void mark2dArray(T ** &x, int numberofRows, int numberofColumns){ x = ... 阅读全文
posted @ 2018-06-11 10:03 我当道士那儿些年 阅读(237) 评论(0) 推荐(0)