摘要: composition 复合 has的关系,在一个类里有另一个类,如下: template <class T> class queue { ... protected: deque<T> c; public: // 以下完全利用c的操作函数完成 bool empty() const { return 阅读全文
posted @ 2022-03-29 20:34 Stella77 阅读(46) 评论(0) 推荐(0)
摘要: 基本结构 #ifndef _MYSTRING_ // 防卫式声明 #define _MYSTRING_ class String { ... } String::function (...) ... Global-function (...) ... 要完成的功能: 1、无参构造和有参构造 2、拷贝 阅读全文
posted @ 2022-03-29 17:19 Stella77 阅读(112) 评论(0) 推荐(0)
摘要: static 1、data members **非静态数据:**属于对象,有几个对象就有几份数据; **静态数据:**不属于对象,只有一份,单独在内存空间里; 2、member functions **非静态函数:**有this指针 **静态函数:**没有this指针,只能处理静态数据 用stati 阅读全文
posted @ 2022-03-29 17:18 Stella77 阅读(35) 评论(0) 推荐(0)