Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error C3299

Error Message

'member_function' : cannot specify constraints, they are inherited from the base method

When overriding a generic member function, you cannot specify constraint clauses (repeating the constraints implies that the constraints are not inherited).

The constraint clauses on the generic function you are overriding will be inherited.

For more information, see Constraints.

Example

The following sample generates C3299.

// C3299.cpp
// compile with: /clr /c
public ref struct R {
   generic<class T> 
   where T : R
   virtual void f();
};

public ref struct S : R {
   generic<class T> 
   where T : R   // C3299
   virtual void f() override;
};
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.