473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2546
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Tron Thomas | last post by:
Under the right compiler the following code: class Base { public: virtual void Method(int){} }; class Derived: public Base {
4
by: A Ratcliffe | last post by:
Back again... I have some classes that inherit from each other, as an example... Point (abstract base class) Point3 (for 3D points), derived from Point Point4 (adds a homogenous...
6
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
4
by: Dan | last post by:
I have a need to make a set of classes that all share the same public methods, some implementation and some data. So, I made an abstract base (BaseClass) with an interface (IBaseClass) and a...
17
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that...
7
by: Dennis | last post by:
I have a class named myclass that inheirits from "baseclass". There is a property of "baseclass" that I don't want exposed in the IDE. The MSDN documentation says" "A derived type can hide an...
7
by: OpticTygre | last post by:
If I have a Class "B" that Inherits Class "A", and my application uses class "B", is there a way that I can keep from exposing properties, subs, and events in the Class "A" base class from the...
14
by: Dom | last post by:
Hi all I'm developing a control, and I need to hide some properties to the user. For example, suppose I need Text property to be completely inacessible (from a Form/Code that is into another...
9
by: Torben Laursen | last post by:
Hi I have a class that I use in Excel to define some custom functions. The problem that I have is that the class also has some building functions that for some reason is there: ToString...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.