Inheriting from a template class in c++

前端 未结 6 2129
遥遥无期
遥遥无期 2020-12-12 10:00

Let\'s say we have a template class Area, which has a member variable T area, a T getArea() and a void setArea(T) member

6条回答
  •  既然无缘
    2020-12-12 10:21

    Rectangle will have to be a template, otherwise it is just one type. It cannot be a non-template whilst its base magically is. (Its base may be a template instantiation, though you seem to want to maintain the base's functionality as a template.)

提交回复
热议问题