直截了当:
Chart<IType>
的抽象类,其子项为CandlestickChart<CandlestickChartItem>
等。ChartItem
的抽象类,其子项为CandlestickChartItem
等。ChartSelection
的抽象类,其子项为CandlestickChartSelection
等。相关的代码:
/* --- CHARTS --- */
template <typename IType>
class Chart {
...
typedef std::vector<IType> ChartData;
}
class CandlestickChart :
public Chart<CandlestickChartItem> { }
/* --- CHART SELECTIONS --- */
template <typename ChartType>
class ChartSelection {
...
virtual ChartType::ChartData::const_iterator findStart() = 0;
};
class CandlestickChartSelection : public ChartSelection<CandlestickChart> {
...
CandlestickChart::ChartData::const_iterator findStart() override;
};
编译器对此有何看法:
Error C2253 'ChartSelection<CandlestickChart>::findStart':
pure specifier or abstract override specifier only allowed on virtual function
Error C3668 'CandlestickChartSelection::findStart':
method with override specifier 'override' did not override any base class methods
TL; DR:为什么我的编译器认为子类中的方法findStart
与父类中的虚函数不同?
有没有一种简单的方法可以解决这个问题?