模板
#include <iostream> using namespace std; template<typename T1, typename T2> class Test { public: T1 m_t1; public: Test(T1 t1) { this->m_t1 = t1; } }; int main(void) { typedef Test<int, char> TEST; int a(100); TEST *pMyTest = new TEST(a); cout << pMyTest->m_t1 << endl; return 0; }