473,581 Members | 2,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2565
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*******@gmai l.comwrote in message
news:%2******** ********@TK2MSF TNGP05.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****@dontspa mme.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 'EditorBrowsabl e'
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*******@gmai l.comwrote in message
news:%2******** ********@TK2MSF TNGP05.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****@dontspa mme.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
'EditorBrowsabl e' 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.comwr ote in message
news:24******** *************** **@msnews.micro soft.com...
>"Smokey Grindle" <no****@dontspa mme.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
'EditorBrowsab le' 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
"containmen t" 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******** ******@TK2MSFTN GP02.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.comwr ote in message
news:24******** *************** **@msnews.micro soft.com...
"Smokey Grindle" <no****@dontspa mme.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
'EditorBrowsabl e' 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****@dontspa mme.comschreef in bericht
news:Os******** ******@TK2MSFTN GP03.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.nlschri eb:
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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
8653
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
3744
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 co-ordinate) derived from Point3
6
6655
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
4
1631
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 handful of inherited classes. The static method calls the ctor of the appropriate inherited class and returns it as type IBaseClass. There are no new...
17
2904
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 when the Poodle is upcast to the Dog (in its wildest dreams) it then says "bow wow" where the bernard always says "woof" (see code). Basically, it...
7
5158
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 inherited member by defining a new member with the same signature. This might be done to make a previously public member private or to define new...
7
1179
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 application? For example, if Class "A" has a "StateChanged" event that I don't want the application to see, is there a way to hide exposure to that...
14
2402
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 project/assembly). I tried with attributes: <Browsable(False), _ EditorBrowsable(EditorBrowsableState.Never), _...
9
4176
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 GetType GetHashCode Equals
0
7882
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7808
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5683
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1410
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1145
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.