Override keyword throwing an error while compile

c++, c++11, g++, overriding

Solution

g++ 4.6.3 doesn't support the `override` feature of C++11. When you take away the syntatical errors, this code compiles fine in 4.7.2 and Clang.

Moreover, I think this is what you meant your code to be:

template <typename T>
class Base {
   Base();

   public:
      virtual void myfunc() = 0; 
};

template <typename T>
class Derived : public Base<T> {
   Derived() : Base<T>() {}

   public:
      void myfunc() override;
};

Problem

I have base class ``` template<typename T> Class Base { Base(); public: virtual void myfunc()=0; } ``` I have derived class ``` template<typename T> Class Derived: public Base<T> { Derived():Base() { } public: void myfunc() override; } ``` When I compile `g++ -std=c++0x`, I get the error with the overriding function highlighted, `error: expected ‘;’ at end of member declaration` `error: ‘override’ does not name a type` g++ version is 4.6.

Original source