本文共 489 字,大约阅读时间需要 1 分钟。
#includeusing namespace std;class DemoOne{public: void f(bool someParm=true){ cout<<"DemoOne f functions\n";} void g(){ cout<<"DemoOne g functions\n";} // other functions...};class DemoTwo{public: void f(){ cout<<"DemoTwo f functions\n";} void g(double a=1.12,double b=1.123){ cout<<"DemoTwo g functions\n";} // other functions...};template void h(T& t){ t.f(); t.g();}int _tmain(int argc, _TCHAR* argv[]){ DemoOne one; DemoTwo two; h(one); h(two); return 0;}
转载地址:http://aksll.baihongyu.com/