Compiler Warning (level 2) C4948
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 (level 2) C4948

Error Message

return type of 'accessor' does not match the last parameter type of the corresponding setter

The compiler found a mismatch between what data type is being get and set for an indexed property.

C4948 is only reachable using /clr:oldSyntax.

The following sample generates C4948:

// C4948.cpp
// compile with: /clr:oldSyntax /LD /W2

__gc class MyClass
   int prop __nogc [2];

      __property int get_P(int i)
      // try the following line instead
      // __property char get_P(int i)
         return prop[i];

      __property void set_P(int i, char c)
         prop[i] = c;
};   // C4948
© 2015 Microsoft