Is it possible to create a generic class<T>
which the generic type T
will be the base class
of it?
i.e:
MyClass<Base1> b1 = new MyClass<Base1>();
MyClass<Base2> b2 = new MyClass<Base2>();
b1.Name="test";
b2.ID=1;
Base Classes:
class Base1
{
protected string Name{ get; set;}
}
class Base2
{
protected int ID{ get; set;}
}
Inherited Class:
class MyClass<T>:T //here is the question is it possible dynamic inheritence
{
}