/////////////////////////////////////////////////////////////// // templ2.cpp - demonstrating template with user defined // // type parameter // // // // Refer to Stroustrup, 13.2.3 - Template Parameters // // // // Jim Fawcett, CSE687 - Object Oriented Design, S'00 // /////////////////////////////////////////////////////////////// #include using namespace std; //----< declare two simple classes >--------------------------------- class implem1 { public: void show() { cout << "\n this is implementation #1"; } }; class implem2 { public: void show() { cout << "\n this is implementation #2"; } }; //---< declare template class taking user defined type parameter >--- template class templ3 { T t; public: void show() { t.show(); } }; void main() { cout << "\n Demonstrating template with user defined type parameter " << "\n =========================================================\n"; templ3 tl; tl.show(); templ3 t2; t2.show(); cout << "\n\n"; }