c# - How to Inherit from Generic Parent -
i have parent class
public class genericrepository<tentity> tentity : class { //implementation } and want inherit class, can't seem right,here attempts
public class customerrepository<customer> : genericrepository<customer> { //implementation } or this,
public class customerrepository<t> : genericrepository<t> t : new customer() { } or one
public class customerrepository<t> : genericrepository<customerrepository<t>> t : customerrepository<t> { } no matter do, error. please show me how can inherit class, classes share same namespace
error 'genericrepository' not contain constructor takes 0 arguments customerrepository.cs
it seems base class has no constructor without parameters, if derived class must declare a.constructor , call base class constructor parameter.
class mybase { public mybase(object art) { } } class derived : mybase { public derived() : base(null) { } } in example if remove ctor derived same error.
Comments
Post a Comment