编译器错误 C3236

不允许显式实例化泛型

编译器不允许泛型类的显式实例化。

下面的示例生成 C3236:

// C3236.cpp
// compile with: /clr
generic<class T>
public ref class X {};

generic ref class X<int>;   // C3236

以下示例演示了可能的解决方法:

// C3236b.cpp
// compile with: /clr /c
generic<class T>
public ref class X {};