Is it possible to hide a component that is used as a base class for other
components?
I have two components that perform the same job. Their only difference is
that one works with objects, and the other works with data rows. So, I
derived both from a common base component and used a GoF Template Method
pattern to encapsulate the parts that differ in the derived components.
Here's my problem: I can't make the base component abstract, due to visual
inheritance limitations. (.NET needs to instantiate the base component to
instantiate the derived components.) But that means a developer using my
package could instantiate the base component, which I obviously don't want.
So, is there a simple way to hide the base component from a developer using
the controls, so that only the derived controls are exposed? Thanks.

Signature
David Veeneman
Foresight Systems
Nicholas Paldino [.NET/C# MVP] - 19 Aug 2006 17:18 GMT
David,
You can always set the components visiblity to "private".

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> Is it possible to hide a component that is used as a base class for other
> components?
[quoted text clipped - 12 lines]
> So, is there a simple way to hide the base component from a developer
> using the controls, so that only the derived controls are exposed? Thanks.
Barry Kelly - 19 Aug 2006 18:27 GMT
> You can always set the components visiblity to "private".
I suspect you can't make public descendants of private components.
-- Barry

Signature
http://barrkel.blogspot.com/
Nicholas Paldino [.NET/C# MVP] - 21 Aug 2006 02:25 GMT
Barry,
You can't, but if the controls or members of your public component are
private, then derived classes can't access them.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>> You can always set the components visiblity to "private".
>
> I suspect you can't make public descendants of private components.
>
> -- Barry
David Veeneman - 20 Aug 2006 02:21 GMT
I did discover that I could make the base component abstract, at the cost of
sacrificing Designer support for the derived components. However, since the
components don't have visual elements, and they don't contain other
components, it's no real sacrifice.

Signature
David Veeneman
Foresight Systems