Muokkaa

Jaa


Compiler Warning C4485

'override_function' : matches base ref class method 'base_class_function ', but is not marked 'new' or 'override'; 'new' (and 'virtual') is assumed

An accessor overrides, with or without the virtual keyword, a base class accessor function, but the override or new specifier was not part of the overriding function signature. Add the new or override specifier to resolve this warning.

See override and new (new slot in vtable) for more information.

C4485 is always issued as an error. Use the warning pragma to suppress C4485.

Example

The following sample generates C4485

// C4485.cpp
// compile with: /clr
delegate void Del();

ref struct A {
   virtual event Del ^E;
};

ref struct B : A {
   virtual event Del ^E;   // C4485
};

ref struct C : B {
   virtual event Del ^E {
      void raise() override {}
      void add(Del ^) override {}
      void remove(Del^) override {}
   }
};