摘要:
需求:设计一个数据模板类(MyVector),完成对int、char、Teacher类型元素的管理。 思路:类模板 构造函数 拷贝构造函数 <<运算符重载 []重载 =运算符重载 实现: MyVector.h: #include<iostream> using namespace std; temp 阅读全文
摘要:
类模板中static关键字所定义的静态变量,因为编译两次的原理,不同类型的类所使用的静态变量不同,各用各的。 程序: #include<iostream> using namespace std; template<typename T> class AA { public: static T m_ 阅读全文