469,648 Members | 1,527 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

hiding properties or methods in inherited class

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!
Jul 24 '06 #1
10 2336
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!

Jul 24 '06 #2
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" <gh*******@gmail.comwrote in message
news:%2****************@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!


Jul 24 '06 #3
"Smokey Grindle" <no****@dontspamme.comschrieb:
>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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jul 24 '06 #4
Hello Smokey,

You are absolutely correct. Shadows would be your only option in this scenario
then.

-Boo
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" <gh*******@gmail.comwrote in message
news:%2****************@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!

Jul 24 '06 #5
"Smokey Grindle" <no****@dontspamme.comschrieb:
>
>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
Jul 24 '06 #6
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" <ji*************@hotmail.comwrote in message
news:24*************************@msnews.microsoft. com...
>"Smokey Grindle" <no****@dontspamme.comschrieb:
>>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


Jul 25 '06 #7
"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.

"Smokey Grindle" <no****@nospam.netwrote in message
news:uh**************@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" <ji*************@hotmail.comwrote in message
news:24*************************@msnews.microsoft. com...
"Smokey Grindle" <no****@dontspamme.comschrieb:

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


Jul 25 '06 #8
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
"Smokey Grindle" <no****@dontspamme.comschreef in bericht
news:Os**************@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!

Jul 25 '06 #9
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
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/>

Jul 25 '06 #10
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

"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
>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/>

Jul 25 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Tron Thomas | last post: by
4 posts views Thread by A Ratcliffe | last post: by
4 posts views Thread by Dan | last post: by
17 posts views Thread by Bob Weiner | last post: by
7 posts views Thread by OpticTygre | last post: by
14 posts views Thread by Dom | last post: by
9 posts views Thread by Torben Laursen | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.