Hi all,
I'm trying to hide a member from a base class, like so :
public class class1
{
public class1()
{
}
public int i;
}
public class class2 : class1
{
public class2()
{
}
private new int i;
}
This article : http://msdn.microsoft.com/library/de...ec_3_7_1_2.asp
, like others, states that now, class2 shouldn't have a property i.
Unfortunatelly, it still does.
My goal eventually is to create a custom user control inherited from
CustomValidator that doen not has a ServerValidate event.
Any ideas on how you cab hide properties and events?,
Greetz,
Owin
Amsterdam 2 1784
owingruters <ow*********@ho tmail-dot-com.no-spam.invalid> wrote: I'm trying to hide a member from a base class
Bad idea.
, like so : public class class1 { public class1() { } public int i; }
public class class2 : class1 { public class2() { } private new int i; }
This article : http://msdn.microsoft.com/library/default.asp?url= /library/en-us/csspec/html/vclrfcsharpspec _3_7_1_2.asp , like others, states that now, class2 shouldn't have a property i.
Unfortunatelly, it still does.
Actually, it doesn't - it doesn't have any properties. It still has a
publically available i variable, however.
Name hiding doesn't actually make anything unavailable, it just changes
how you have to access the member in question.
My goal eventually is to create a custom user control inherited from CustomValidator that doen not has a ServerValidate event.
You won't be able to do that, and a good job too - it would break the
Liskov Substitutabilit y Rule. It sounds like you might want to
encapsulate CustomValidator instead of inheriting from it.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Hi Jon,
Thanx for answering!
I understand what u mean, so I'll just leave the ServerValidate event
available for my users!
Owin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
Hello NG,
Regarding access-declarations and member using-declarations as used to
change the access level of an inherited base member...
Two things need to be considered when determining an inherited base member's
access level in the derived class: its access level in the base class and
the type of inheritance (public, protected, or...
|
by: Josh Mcfarlane |
last post by:
I'm doing recomposition of objects from binary streams, and the best
way for me to write them out is to write base class data first, forward
to inherited classes, pointer class values, etc.
Now, when recomposing these objects, I first read the base class data,
and can create a base object.
When I find the inherited class marker, can I...
|
by: C-Sharper or C-Hasher, one of the two |
last post by:
Hi,
I have a C# class libary (Class1) which is inherited by another class in a
Windows Forms app. I want this other class to implement some, but not all of
the features of the base class. How can I completely hide (within the IDE)
the members of the base class library i.e. only expose those members that I
want exposed? I've tried some...
|
by: Alex Sedow |
last post by:
Example 1
interface I
{
string ToString();
}
public class C : I
{
public void f()
{
|
by: TS |
last post by:
I am trying to get set a property of a control on the inherited class from
base class. I imagine i have to use reflection, so could someone give me the
code to do it?
something like this?
this.GetType().GetMember("panel1").SetValue(xx).Left = 44;
| |
by: Ray Cassick \(Home\) |
last post by:
Ok, I have finally decided that there is ONE big thing about VB.NET (not
sure if this same thing exists in C# yet) that really ticks me off. Either I
am missing the point here or I have not found what I need to accomplish my
need.
I am creating a Windows forms user control and am inheriting from
System.Windows.Forms.UserControl. There are...
|
by: Jeff User |
last post by:
Hello
I am using C#, .net1.1
Vis Studio 2003
I am using homeBase.aspx.cs page as a base for several other
aspx/aspx.cs web pages. The base page handles some operations that are
common to all pages. like this:
somepage...
public class homeBase : System.Web.UI.Page
....
then other pages.....
|
by: Mike C# |
last post by:
Suppose I have a base class "foo". Another class, "bar" derives from it.
Base class "foo" has a method called "rob_the_liquor_store()", and the
inherited class "bar" overrides this method with one of its own, maybe
specifying the liquor store over on 44th Street and 5th Avenue or something.
Anyway this is what we have so far:
base class:...
|
by: jan.loucka |
last post by:
Hi,
We're building a mapping application and inside we're using open
source dll called MapServer. This dll uses object model that has quite
a few classes. In our app we however need to little bit modify come of
the classes so they match our purpose better - mostly add a few
methods etc.
Example: Open source lib has classes Map and Layer...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |