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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -