public class Foo where T:Foo { public T n; public T next() { return n; } } public class Goo : Foo { public int x; } public class Test { public static void Main() { Goo x = new Goo(); x=x.next(); } }