using System; namespace test { public class Factory where T : Factory, new() { public virtual T Make() { return new T(); } } public class DerivedA : Factory { public DerivedA() { Console.WriteLine("DerivedA ctor"); } } public class DerivedB : Factory { public DerivedB() { Console.WriteLine("DerivedB ctor"); } } static class main { static void Main(string[] args) { DerivedA a = new DerivedA(); DerivedB b = new DerivedB(); DerivedB binst = b.Make(); DerivedA ainst = a.Make(); } } }