Compiler Warning C4485
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning C4485

Error Message

'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.


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 {}
© 2016 Microsoft