Edward Diener said:
Daniel O'Connell wrote:
I do not believe this feature is supported in .NET.
I don't think so either.
A neat feature in C++ Builder was the ability to design a base class
component with full functionality, called something like
"CustomAComponentName", many of whose properties, methods, and
events were protected, and then each derived class with only
refined functionality, called something like "AComponentName", could
decide which of these areas could be made public ( or __published )
in the derived class. As it is now, if a base class exposes a
property, method, or event, there is no way to eliminate that
exposure in a derived class. Yet this last is often a valid
programming paradigm. My derived class is often a more particular
version of the base class which exposes a simpler interface. But in
.NET the full base class interface most always be exposed. That
seems a deficiency of the language design.
The oft quoted Liskov substitution principle[1] probably fits here.
In any given case, a given class should be able to be used as its
parent, meaning that you shouldn't be able to reduce privledge to a
given member, or should only be able to do so in appearence(like
explicit interface implementation or VB's renamable interface
methods(not sure of hte name for that)). I can however see the
purpose in allowing it to be expanded, if proper care is taken.