摘要:
#include<iostream> #include<stdlib.h> #include<string> using namespace std; /* 1.2.4 普通函数和函数模板的区别 普通函数调用时可以发生自动类型转换(隐式类型转换) 函数模板调用时,如果利用自动类型推导,不会发生隐式类 阅读全文
posted @ 2021-04-17 20:06
yub4by
阅读(56)
评论(0)
推荐(0)
摘要:
#include<iostream> #include<stdlib.h> #include<string> using namespace std; /* 1.2.3函数模板案例 利用函数模板封装一个排序的函数,可以对不同数据类型数组进行排序 排序规则从大到小,排序算法为选择排序 */ templ 阅读全文
posted @ 2021-04-17 20:05
yub4by
阅读(63)
评论(0)
推荐(0)
摘要:
#include<iostream> #include<stdlib.h> #include<string> using namespace std; /* 1.2.2函数模板注意事项 自动类型推导,必须推导出一致的数据类型T,才可以使用 模板必须要确定出T的数据类型,才可以使用 */ templa 阅读全文
posted @ 2021-04-17 20:04
yub4by
阅读(74)
评论(0)
推荐(0)
摘要:
#include<iostream> #include<stdlib.h> #include<string> using namespace std; /* 1.1模板概念 C++另一种编程思想称为 泛型编程 ,主要利用的技术就是模板 C++提供两种模板机制:函数模板和类模板 */ /* 1.2函数 阅读全文
posted @ 2021-04-17 20:03
yub4by
阅读(63)
评论(0)
推荐(0)
摘要:
work.h #pragma once#include#includeusing namespace std;// 职工抽象类class Worker{public: int id; string name; int dept_id; ... 阅读全文
posted @ 2021-04-17 15:17
yub4by
阅读(191)
评论(0)
推荐(0)

浙公网安备 33010602011771号