#include <iostream> #include <vector> using namespace std; template < class T > //类模板 class Student { public: Student(T x) { this->a = x; } ~Student() { } public: T a; }; template<typename Y> //函数模板 Y test(Y a, Y b) { return a +…
#include <iostream> #if 0//函数模板 template<typename T> T max(T a, T b, T c)//函数模板 { if (a < b) { a = b; } if (a < c) { a = c; } return c; } #endif template<class T> class Compare { public: T max(T a, T b); T min(T a, T b); }; templat…