I was just going through my Code Project article on Function overriding in C++/CLI, and I noticed how the code snippets in the article indicated that if you don’t specify new or override on a derived class virtual function, override is assumed. Well, I was using an early Alpha compiler when I wrote that article and now, in the RTM version of the compiler, the compiler will not let you do that. For virtual functions of ref types, overriding is always explicit.
ref class Base
{
public:
virtual void F(){}
};
ref class Derived : Base
{
public:
virtual void F() {} // <-- error C4485
};
The right way would be to do one of the following :-
virtual void F() override {}
// or
virtual void F() new {}