共用方式為


編譯器錯誤 C3298

'constraint_1': 無法將 'constraint_2' 當做條件約束使用,因為 'constraint_2' 具有 ref 條件約束,而且 'constraint_1' 具有值條件約束

備註

您不能指定條件約束的互斥特性。 例如,泛型類型參數不能同時限制為實值類型和參考類型。

如需詳細資訊,請參閱泛型型別參數的限制式 (C++/CLI)

範例

下列範例會產生 C3298。

// C3298.cpp
// compile with: /clr /c
generic<class T, class U>
where T : ref class
where U : T, value class   // C3298
public ref struct R {};