Compiler Error C2835
TOC
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 Error C2835

Error Message

user-defined conversion 'type' takes no formal parameters

User-defined type conversions cannot take formal parameters.

The following sample generates C2835:

// C2835.cpp
class A {
public:
   char v_char;

   A() { 
      v_char = 'A'; 
   };
   operator char(char a) {   // C2835
   // try the following line instead
   // operator char() {   
      return v_char + 1; 
   };
};

int main() {
   A a;
}
Show:
© 2016 Microsoft