Export (0) Print
Expand All
Expand Minimize

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

Community Additions

© 2015 Microsoft