I have the following set up:
public abstract class A
{
public void f()
{
//Want to make an instance of B or C here
//A bOrC = new ?
}
public abstract void f2();
}
public class B : A { public override void f2(){} }
public class C : A { public override void f2(){} }
Is this possible? If so how?
Edit: bOrC needs to be the type of the particular derived class f() is called from
I can think of two ways to solve this issue. One uses generics and the other just requires an abstract method. First the simple one.
And now with generics