Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
the constraints for generic parameter 'parameter' of function 'function' must match the constraints for generic parameter 'parameter' of function 'function'
Remarks
A virtual generic function must use the same constraints as a virtual function with the same name and set of arguments in the base class.
Example
The following example generates C3284:
// C3284.cpp
// compile with: /clr /c
// C3284 expected
public interface class IGettable {
int Get();
};
public interface class B {
generic<typename T>
where T : IGettable
virtual int mf(T t);
};
public ref class D : public B {
public:
generic<typename T>
// Uncomment the following line to resolve.
// where T : IGettable
virtual int mf(T t) {
return 4;
}
};