
c++
文章平均质量分 78
nonororo
这个作者很懒,什么都没留下…
展开
-
c++学习笔记 类和动态内存分配与特殊成员函数
上一个例子中是仿string类Str使用的是char数组类储存,但是这样有大小限制(100),能不能让它动态的进行调整大小呢? 已定义的char数组行不通,但是让一个指针指向一块规定大小的内存是可以的,于是我可以使用内存分配来完成任意大小的Str类 这种方法叫动态内存分配:原创 2015-08-19 12:53:43 · 719 阅读 · 0 评论 -
c++学习笔记 类继承
现在有一个记录身份ID的类: //head.h #ifndef HEAD_H_ #define HEAD_H_ #include #include using namespace std; class IDcard { string name; int id; public: IDcard(const string n = "null", const int i = 0);原创 2015-08-22 13:07:03 · 548 阅读 · 1 评论 -
c++学习笔记 初识类与对象
个人学习c++笔记原创 2015-08-17 14:53:50 · 419 阅读 · 0 评论 -
c++学习笔记 类运算符重载与友元与类型转换
有这样一个类: class Str { char str[100]; int n; public: Str(const char *pstr = "\0"){ strcpy(str, pstr); n = strlen(str); } const char *getstr()const{ return str; } const int getcount()const{原创 2015-08-18 23:10:52 · 592 阅读 · 0 评论