类模板:
#include
usingnamespace std;
template<typename T>
classOp{
public:
T peocess(T v)
{
return v * v;
}
};
int main()
{
Op opInt;
Op opDouble;
cout <<"5 * 5 = "<< opInt.peocess(5)<<endl;
cout <<"0.5 * 0.5 = "<< opDouble.peocess(0.5)<<endl;
}