I have two class which extends a base class and baseclass takes 5 argument but in two of my derived class I don't want to pass 5 arguments . can anyone tell me how to bypass it . I'm new at this . please help
Example :
BaseClass
public abstract class xyz<TOrderView, Component1, Component2, Component3, Component4>
Derived class 1
public class abcdef : xyz<IOrderView, Component1, Component2, Component3>
Derived class 2 public class rdesa : xyz
Class abcdef doesn't need 5 argument but class rdesa need to pass 5 argument . Can anyone tell me how to pass null as argument to base class . I'm new at this please help .
Long answer:
You need to re-examine your inheritance hierarchy after reading up on the Liskov substitution principle.
Short answer: You can pass some acceptable type to the base class constructor.
public class abcdef<IOrderView, Component1, Component2, Component3>
: xyz<IOrderView, Component1, Component2, Component3, object>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.