Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.3 KB

compiler-warning-c4485.md

File metadata and controls

43 lines (33 loc) · 1.3 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning C4485
Compiler Warning C4485
11/04/2016
C4485
C4485
a6f2b437-ca93-4dcd-b9cb-df415e10df86

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 {}
   }
};