Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 792 Bytes

compiler-error-c2801.md

File metadata and controls

39 lines (28 loc) · 792 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C2801
Compiler Error C2801
11/04/2016
C2801
C2801
35dfc7ea-9e37-4e30-baa1-944dc61302f5

Compiler Error C2801

'operator operator' must be a non-static member

The following operators can be overloaded only as nonstatic members:

  • Assignment =

  • Class member access ->

  • Subscripting []

  • Function call ()

Possible C2801 causes:

  • Overloaded operator is not a class, structure, or union member.

  • Overloaded operator is declared static.

  • The following sample generates C2801:

// C2801.cpp
// compile with: /c
operator[]();   // C2801 not a member
class A {
   static operator->();   // C2801 static
   operator()();   // OK
};