摘要:
template class SmartPtr { T* m_p; public: SmartPtr(T* p) : m_p(p) {} T* operator->() { return m_p; } } class XxX { public: void foo(); } int main() { Xxx x; ... 阅读全文
摘要:
一。函数模板的特化 考虑: template T max(T a, T b) { return a > b ? a : b; } int main() { cout char* max(char* a, char* b) { return strlen(a) > strlen(b) ? a : b; } 二。类模板的特化 template class Test { ... 阅读全文
摘要:
class Base1 { public: virtual void foo(); }; class Base2 { public: virtual void foo(); }; class Derived : public Base1, public Base2 { public: virtual void foo(); }; #define SOMETHING... 阅读全文