Using Template In Class

xiaoxiao2021-03-06  61

Today I Studied Using Template IN a class.the Following Is The Code: 1.Header File: Template.h: #include Using Namespace Std; Template Class Cal {Public: Cal () {}

T Calculate (T &, T &, T &, Template.cpp # include #include #include #include "template.h" Using Namespace std; template < Class T> T Cal :: Calculate (T & T1, T & T2) {RETURN T1 T2;} main () {CAL * c = new cal (); int a = 100; int> INT B = 200; COUT << C-> Calculate (A, B) << Endl; return 0;} The last execution result is as follows:

转载请注明原文地址:https://www.9cbs.com/read-111528.html

New Post(0)