Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (level 2) C4948
Collapse the table of content
Expand the table of content

Compiler Warning (level 2) C4948

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