Solved

Hiding a property

Posted on 2004-09-01
3
269 Views
Last Modified: 2010-04-15
Hi everyone ..

I have a control NumericTextBox which is inherited from TextBox. Now, TextBox has a property named .Text which I would like to hide from the programmer.

So if the user adds a NumerictextBox to his form, there should be no option .Text

NumericTextBox myNtb = new NumericTextBox();
myNtb.Font ... works
myNtb.Size ... works
myNtb.Text ... doesn't exist


Is there any way how I can do that ?
0
Comment
Question by:somnatic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 11951711
You can't ... the only thing you could do is override the .Text method ...

There is reason for this though. If you could inherit from a class to remove functionality (i.e. externally visible items) you would break polymorphism.
0
 
LVL 4

Author Comment

by:somnatic
ID: 11951769
ok, already thought so .. only couldn't think of a reason ..

but now that's clear .. makes sense as well :)
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11951805
glad to help.

Cheers,

Greg
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question