基于继承的复用技术:

class CBase
{
  public:
     CBase(){}
     ~CBase(){}
     void BaseMethod()
     {
        cout<<"BaseMethord in Base"<<endl;
     }
};

class CMath : public CBase
{
  public:
     CMath(){}
     ~CMath(){}
};

基于模板的复用技术:

template<class T>

class CComObject:public T
{
  public:
     CComObject(){}
     ~CComObject(){}
     void CallBaseMethod()
     {
        T* pT = STATIC_CAST<T*>(this);
        pT->BaseMethod();
     }
}

CComObject<CMath>* pMath = new CComObject<CMath>;
pMath->CallBaseMethod();