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

Popular posts from this blog

testing - Detect whether test has failed within fixture -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

android - Create single AAR file from multiple modules using Gradle -