Hide a componet?

  • Thread starter Thread starter David Veeneman
  • Start date Start date
D

David Veeneman

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.
 
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.
 
Barry,

You can't, but if the controls or members of your public component are
private, then derived classes can't access them.
 
Back
Top