#include<iostream.h> template<class T> class Sample { T n; public: Sample(T i){ n=i; } int operator==(Sample &s) { if(n==s.n) return 1; else return 0; } }; int main() { Sample<int> s1(2),s2(3); cout<<(s1==s2)<<endl; Sample<double> s3(2.5),s4(2.5); cout<<(s1==s2)<<endl; }
0 0