J
Jeff.Boeker
Hello,
I have a group of custom controls and each control is derived from a
base class that performs some standard operations and enforces an
interface by having some abstract methods. Ideally, I don't want my
base class visible outside the assembly; also no instantiation, and no
access by nonderived types. Since C# does not allow multiple
inheritance, I derive my CBaseCtrl from System.Window.Forms.UserControl
and then derive each control from that, e.g. CButtonCtrl : CBaseCtrl.
My initial idea was to make the CBaseCtrl internal abstract and the
CButtonCtrl public but this results in a CS0060 inconsistent
accessibility error. Even if I change the base class to public
abstract so compilation succeeds, when I try to show the designer it
complains that the base class cannot be loaded (because it is
abstract). What is the best way out of this apparent conundrum?
Thanks,
Jeff
I have a group of custom controls and each control is derived from a
base class that performs some standard operations and enforces an
interface by having some abstract methods. Ideally, I don't want my
base class visible outside the assembly; also no instantiation, and no
access by nonderived types. Since C# does not allow multiple
inheritance, I derive my CBaseCtrl from System.Window.Forms.UserControl
and then derive each control from that, e.g. CButtonCtrl : CBaseCtrl.
My initial idea was to make the CBaseCtrl internal abstract and the
CButtonCtrl public but this results in a CS0060 inconsistent
accessibility error. Even if I change the base class to public
abstract so compilation succeeds, when I try to show the designer it
complains that the base class cannot be loaded (because it is
abstract). What is the best way out of this apparent conundrum?
Thanks,
Jeff