I have a generic type G<T> where T : A, where A is an abstract class. In each class B derived from A I want to have a field of type G<B>, without writing repetetive code, however I'm not sure if it's even possible. One way to do this would be
abstract class A
{
    protected object g;
    protected abstract void SetG();
    public A()
    {
        SetG();
    }
}
class B : A
{
    protected override void SetG()
    {
        this.g = new G<B>();
    }
    public B() : base() {}
}
But this would mean a lot of repetetive code in every derived class. Is there a better way to do this?