#include <iostream> using 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<typename T> void h(T& t){ t.f(); t.g(); } int _tmain(int argc, _TCHAR* argv[]) { DemoOne one; DemoTwo two; h(one); h(two); return 0; }
时间: 2024-11-01 02:34:27