473,729 Members | 2,177 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 2578
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
8666
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
3750
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
6661
by: Microsoft | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
4
1634
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 methods or properties in the inherited classes and public clients never need to know which...
17
2915
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 appears that I'm hiding the poodle's speak method from everything except the poodle. Why would I...
7
5174
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 behavior for an inherited method that is marked as final. " However, this does not hide the...
7
1187
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 event in Class "B"? Thanks for any help.
14
2421
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), _ RefreshProperties(RefreshProperties.Repaint), _
9
4188
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
9280
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6016
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.