0

Straight to the point:

  1. I have an abstract class called Chart<IType> with child CandlestickChart<CandlestickChartItem> etc.
  2. ... an abstract class called ChartItem with child CandlestickChartItem etc.
  3. ... an abstract class called ChartSelection with child CandlestickChartSelection etc.

Relevant piece of code:

/* --- 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;
};

How compiler feels about this:

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: Why does my compiler think that the method findStart in the child class is different from the virtual function in the parent class? Is there a simple way to solve this?

user35443
  • 6,309
  • 12
  • 52
  • 75

0 Answers0