随笔1

template<typename T>
class SquareMatriBase{
protected:
    void invert(std::size_t matrixSize);
};

template<typename T, std::size_t n>
class SquareMatrix : private SquareMatriBase<T>//private继承表示SquareMatrix由SquareMatriBase<T>继承而来
{
private:
    using SquareMatriBase<T>::invert;//避免遮掩base版的invert
public:
    void invert(){ this->invert(n); }//this->表示调用基类的
};

 

posted @ 2017-03-19 17:22  zzyoucan  阅读(99)  评论(0编辑  收藏  举报