//头文件
#ifndef PERSON_H
#define PERSON_Htemplate <typename T>
class Person
{
public:
Person();
virtual ~Person();
T fun1(T a);
void fun2(T a);
protected:
private:
};
#endif // PERSON_H
//实现类
#include "Person.h"
#include <iostream>
using namespace std;
template <typename T>
Person<T>::Person()
{
//ctor
}
template <typename T>
T Person<T>::fun1(T a){
return a;
}
template <typename T>
void Person<T>::fun2(T a){
cout<<"fun2";
}
template <typename T>
Person<T>::~Person()
{
//dtor
}