#include #include using namespace std; //myClassTemplate2 // defiining template // using Type Template // compare with myStructNonType Template //where we used template template class Compare { public: T n1, n2; Compare (T first, T second) {n1=first; n2=second;} T higherValue (); //you can't call cout << "\n template defined " ; }; // defining template parameter type template T Compare::higherValue () { cout << "\n ----> template initialized " ; // T represents the method declared before T compare; // method or function that will compare to values cout << " \n value compared || " << n1 << " : " << n2 <<"\n Higher value is : "; compare = n1>n2? n1 : n2; return compare; } // int main () { int n11 = 100; Compare myobject1 (n11, 75); cout << myobject1.higherValue(); Compare myobject2 (25.25, 74.275); cout <<"" << myobject2.higherValue(); Compare myobject3 ("Hello","Living World"); cout <<"" << myobject3.higherValue(); return 0; }