我在如何处理类get方法中 的模板值返回时遇到了麻烦SetOfCells。
是否可以按照如下所示的方式进行?这样做的正确语法是什么?(我使用cellParent指针数组指向每个单元格)
template <class T>
class cell : public cellParent
{
.....
T get() { return Val;}
.....
private:
T val;
};
class SetOfCells
{
....
template<class T> T get(int cellIndex)
{
return cellArray[cellIndex]->get();
}
....
private:
cellParent** cellArray;
};