/* function template programmer:qpz */ #include <iostream> using namespace std; template <class T> class Myclass{ private: T x,y; public: Myclass(T x,T y) { this->x=x; this->y=y; } T Max() { return x>y?x:y; } }; int main(void) { // Myclass s1(1,2.3); 错误申明 Myclass <int> s1(1,2); cout<<s1.Max()<<endl; return 0; }