c# - "Multiple inheritance" - methods for a derived base class -
summary
in vb.net (.net 4.0), possible derive listcontrol , have same method available radiobuttonlist, checkboxlist, dropdownlist?
edit: have added c# tag in hope c# have solution can used vb.net. if not case remove tag stop confusion.
details
using exceptionally helpful answer, have written class (derived dropdownlist) allow me persist attributes on individual .item objects across post-backs.
i extend functionality radiobuttonlist , checkboxlist controls, can't figure out if possible - , if is, how it.
this have been straight forward in c++, has ability multiple inheritance - i'm stuck here.
the obvious solution replicate dropdownlist derived class, prefer if code wasn't repeated 3 times.
can point me in right direction, i'm having real brain-fart here?
this have derived dropdownlist control, , works perfectly...
<toolboxdata("<{0}:dropdownlistpersistant runat=""server""></{0}:dropdownlistpersistant>"), defaultproperty("text")> _ public class dropdownlistpersistant inherits dropdownlist protected overrides function saveviewstate() object ... end function protected overrides sub loadviewstate(byval savedstate object) ... end sub end class this tried, not work, because dropdownlistpersistant no longer derived dropdownlist...
public class listcontrolpersistant inherits listcontrol protected overrides function saveviewstate() object ... end function protected overrides sub loadviewstate(byval savedstate object) ... end sub end class <toolboxdata("<{0}:dropdownlistpersistant runat=""server""></{0}:dropdownlistpersistant>"), defaultproperty("text")> _ public class dropdownlistpersistant inherits listcontrolpersistant end class
try extension method. think can have emulate multiple inheritance extension methods below.
http://coding.abel.nu/2012/05/emulating-multiple-inheritance-with-extension-methods/
Comments
Post a Comment