template模板
// C++练习.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" template <typename x,typename x1>x xxx(x a,x1 a1){ //相当于方法参数会把template里面的参数给替换掉, x abc = 123; return a; } int _tmain(int argc, _TCHAR* argv[]) { int a = xxx(1,2); printf("%d",a); getchar(); }

浙公网安备 33010602011771号