Compiler Error C2555

'class1::function1' : overriding virtual function differs from 'class2::function2' only by return type or calling convention

The specified virtual function and a derived overriding function had identical parameter lists but different return types.

An overriding function in a derived class cannot be redefined to differ only by its return type from a virtual function in a base class.

A function in a derived class or structure overrides a virtual function in a base class only if their names, parameters, and return values are all identical. (If the functions have different parameters, the compiler treats them as different functions and does not override the virtual function.)

It may be necessary to cast the return value after the virtual function has been called.

The following is an example of this error:

struct X
{
   virtual void func();
};
struct Y : X
{
   char func();  // error
};