|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
hiding properties or methods in inherited classi want to inherit the list view class, but in the inherited class, hide the
Header style property and the view property (basically its a detailed list with always clickable headers) how do I keep the base class properties from showing up in the inherited class when people change its properties in the IDE? thanks! Hello Smokey,
override (or shadow) the properties and change their scope. (hint: private or friend scope properties will not be exposed to the public interface) -Boo Show quoteHide quote > i want to inherit the list view class, but in the inherited class, > hide the Header style property and the view property (basically its a > detailed list with always clickable headers) how do I keep the base > class properties from showing up in the inherited class when people > change its properties in the IDE? thanks! > I thought you coudnt change the scope qualifier of an override though, I
guess shadows is the way to go then since it does allow changing of the scope qualifier, am I thinking correctly? Show quoteHide quote "GhostInAK" <ghosti***@gmail.com> wrote in message news:%23noamB2rGHA.1140@TK2MSFTNGP05.phx.gbl... > Hello Smokey, > > override (or shadow) the properties and change their scope. (hint: > private or friend scope properties will not be exposed to the public > interface) > > -Boo > >> i want to inherit the list view class, but in the inherited class, >> hide the Header style property and the view property (basically its a >> detailed list with always clickable headers) how do I keep the base >> class properties from showing up in the inherited class when people >> change its properties in the IDE? thanks! >> > > Hello Smokey,
You are absolutely correct. Shadows would be your only option in this scenario then. -Boo Show quoteHide quote > I thought you coudnt change the scope qualifier of an override though, > I guess shadows is the way to go then since it does allow changing of > the scope qualifier, am I thinking correctly? > > "GhostInAK" <ghosti***@gmail.com> wrote in message > news:%23noamB2rGHA.1140@TK2MSFTNGP05.phx.gbl... > >> Hello Smokey, >> >> override (or shadow) the properties and change their scope. (hint: >> private or friend scope properties will not be exposed to the public >> interface) >> >> -Boo >> >>> i want to inherit the list view class, but in the inherited class, >>> hide the Header style property and the view property (basically its >>> a detailed list with always clickable headers) how do I keep the >>> base class properties from showing up in the inherited class when >>> people change its properties in the IDE? thanks! >>> "Smokey Grindle" <nospam@dontspamme.com> schrieb: Override them and set the appropriate 'Browsable' and 'EditorBrowsable' >i want to inherit the list view class, but in the inherited class, hide the >Header style property and the view property (basically its a detailed list >with always clickable headers) how do I keep the base class properties from >showing up in the inherited class when people change its properties in the >IDE? thanks! attributes. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> > "Smokey Grindle" <nospam@dontspamme.com> schrieb: Of course, this doesn't keep the developer from using the base methods. They > >> i want to inherit the list view class, but in the inherited class, >> hide the Header style property and the view property (basically its a >> detailed list with always clickable headers) how do I keep the base >> class properties from showing up in the inherited class when people >> change its properties in the IDE? thanks! >> > Override them and set the appropriate 'Browsable' and > 'EditorBrowsable' attributes. > just don't see them in the IDE with intellisense. What you are doing however is breaking a fundamental tenant of OOP. Consider if your implementing class really "IS-A" type of the inherited class. If not, you may be better off using containment rather than inheritance. Jim Wooley http://devauthority.com/blogs/jwooley/default.aspx What exactly is containment? What im doing is extending the functionality of
a list view but I dont want any one to inherit it and change it after this point Show quoteHide quote "Jim Wooley" <jimNOSPAMwooley@hotmail.com> wrote in message news:24f81e8f72c18c87d5ddd167ad3@msnews.microsoft.com... >> "Smokey Grindle" <nospam@dontspamme.com> schrieb: >> >>> i want to inherit the list view class, but in the inherited class, >>> hide the Header style property and the view property (basically its a >>> detailed list with always clickable headers) how do I keep the base >>> class properties from showing up in the inherited class when people >>> change its properties in the IDE? thanks! >>> >> Override them and set the appropriate 'Browsable' and >> 'EditorBrowsable' attributes. >> > Of course, this doesn't keep the developer from using the base methods. > They just don't see them in the IDE with intellisense. What you are doing > however is breaking a fundamental tenant of OOP. Consider if your > implementing class really "IS-A" type of the inherited class. If not, you > may be better off using containment rather than inheritance. > > Jim Wooley > http://devauthority.com/blogs/jwooley/default.aspx > > "containment" is where instead of inheriting your base class, you create a
private variable of the base class type and then explicitely expose, via your code, the methods and properties of the base class. As far as violating basic OOP principles - it doesn't in that sometimes you need to control specific properties and methods of the base class in your derived class. Mike Ober. Show quoteHide quote "Smokey Grindle" <nospam@nospam.net> wrote in message news:uhMsiN4rGHA.4004@TK2MSFTNGP02.phx.gbl... > What exactly is containment? What im doing is extending the functionality of > a list view but I dont want any one to inherit it and change it after this > point > > > "Jim Wooley" <jimNOSPAMwooley@hotmail.com> wrote in message > news:24f81e8f72c18c87d5ddd167ad3@msnews.microsoft.com... > >> "Smokey Grindle" <nospam@dontspamme.com> schrieb: > >> > >>> i want to inherit the list view class, but in the inherited class, > >>> hide the Header style property and the view property (basically its a > >>> detailed list with always clickable headers) how do I keep the base > >>> class properties from showing up in the inherited class when people > >>> change its properties in the IDE? thanks! > >>> > >> Override them and set the appropriate 'Browsable' and > >> 'EditorBrowsable' attributes. > >> > > Of course, this doesn't keep the developer from using the base methods. > > They just don't see them in the IDE with intellisense. What you are doing > > however is breaking a fundamental tenant of OOP. Consider if your > > implementing class really "IS-A" type of the inherited class. If not, you > > may be better off using containment rather than inheritance. > > > > Jim Wooley > > http://devauthority.com/blogs/jwooley/default.aspx > > > > > > Smokey,
You cannot hide properties from the base class showing up in the IDE. You can see the same with some standard control classes where some of the properties don't do anything. Direct from my mind, the background in the picturebox is one of those but there are many more. It does not helps, however maybe is it helpful to know. Cor Show quoteHide quote "Smokey Grindle" <nospam@dontspamme.com> schreef in bericht news:OsXIZ31rGHA.4884@TK2MSFTNGP03.phx.gbl... >i want to inherit the list view class, but in the inherited class, hide the >Header style property and the view property (basically its a detailed list >with always clickable headers) how do I keep the base class properties from >showing up in the inherited class when people change its properties in the >IDE? thanks! > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: You can actually hide overridable properties (and other properties too > You cannot hide properties from the base class showing up in the IDE. IIRC), but you cannot prevent them from being accessed. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried,
The way you showed I have tried in the past with no success. I can be wrong of course, seriously. But it was not one time, while in the standard controls there are lot of things which would be hidden in the IDE property box if that was possible in my idea. Cor Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:%23tn8HQ9rGHA.4272@TK2MSFTNGP03.phx.gbl... > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: >> You cannot hide properties from the base class showing up in the IDE. > > You can actually hide overridable properties (and other properties too > IIRC), but you cannot prevent them from being accessed. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/>
Fastest way to update a Picturebox's image
Dynamic Properties converting API call Editing XML Document Sub Main Ends so does the application Call EXE method from DLL using named instance SSH FTP componet Setting focus to a combobox in a grid VB2005: Controls not appearing on form 2005 Conversion Warning |
|||||||||||||||||||||||