上一页 1 ··· 78 79 80 81 82 83 84 85 86 ··· 91 下一页
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; #include<vector> #include<algorithm> /* 2.5.2 vector容器存放自定义数据类型 */ class P 阅读全文
posted @ 2021-04-22 20:45 yub4by 阅读(174) 评论(0) 推荐(0)
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; #include<vector> #include<algorithm> /* 2.5.1 vector放置内置数据类型 容器: vector 算法 阅读全文
posted @ 2021-04-22 20:44 yub4by 阅读(68) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-04-22 19:44 yub4by 阅读(45) 评论(0) 推荐(0)
摘要: MyArray.hpp #pragma once #include<iostream> #include<string> using namespace std; template<class T> class MyArray { public: // 有参构造 MyArray(int capaci 阅读全文
posted @ 2021-04-18 14:20 yub4by 阅读(143) 评论(0) 推荐(0)
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; /* 1.3.8类模板与友元 掌握类模板配合友元函数的类内和类外实现 全局函数类内实现 - 直接在类内声明友元即可 全局函数类外实现 - 需要提前让 阅读全文
posted @ 2021-04-18 14:16 yub4by 阅读(55) 评论(0) 推荐(0)
摘要: person.h #pragma once #include<iostream> #include<string> using namespace std; template<class T1, class T2> class Person{ public: T1 name; T2 age; Per 阅读全文
posted @ 2021-04-18 14:15 yub4by 阅读(73) 评论(0) 推荐(0)
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; #include<typeinfo> /* 1.3.6类模板成员函数类外实现 */ template<class T1, class T2> cla 阅读全文
posted @ 2021-04-18 14:12 yub4by 阅读(60) 评论(0) 推荐(0)
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; #include<typeinfo> /* 1.3.5类模板与继承 当子类继承的父类是一个类模板时,子类在声明的时候,要指定出父类中T的类型 如果不 阅读全文
posted @ 2021-04-18 14:11 yub4by 阅读(88) 评论(0) 推荐(0)
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; #include<typeinfo> /* 1.3.4类模板对象做函数参数 类模板实例化出的对象,向函数传参的方式 共有三种传入方式: 1. 指定传 阅读全文
posted @ 2021-04-18 11:19 yub4by 阅读(58) 评论(0) 推荐(0)
摘要: #include<iostream> #include<stdlib.h> #include<string> using namespace std; /* 1.3.3类模板中成员函数创建时机 类模板中成员函数和普通类中成员函数创建时机是有区别的: 普通类中的成员函数一开始就可以创建 类模板中的成员 阅读全文
posted @ 2021-04-17 21:19 yub4by 阅读(70) 评论(0) 推荐(0)
上一页 1 ··· 78 79 80 81 82 83 84 85 86 ··· 91 下一页