oop - C# Generic Type Inheritence -
is possible create generic class<t> generic type t 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 question possible dynamic inheritence { }
you mean this?
public class generic<t> : t { }
Comments
Post a Comment