using System;
class MyClass {
}
class Test where T : class {
T obj;
public Test() {
// The following statement is legal only
// because T is guaranteed to be a reference
// type, which can be assigned the value null.
obj = null;
}
public void print(){
Console.WriteLine(obj);
}
}
class ClassConstraintDemo {
public static void Main() {
Test x = new Test();
// The next line is in error because int is
// a value type.
// Test y = new Test();
}
}