473,387 Members | 1,844 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,387 software developers and data experts.

Not inheriting members from the base

If I recall correctly, in C++ there was an access specifier that could
label a data member of a class as "can be accessed by everyone else
EXCEPT the derived class" -- an accurate opposite of "protected". I
think I allude to the "friend" modifier in C++, which is different from
the C# "friend".

Does C# have any such specifier? Is there a method for a child class to
"not" inherit some properties off its base class?

May 16 '06 #1
4 1607
>which is different from the C# "friend".

I meant to say, _different from the C# "internal"._

May 16 '06 #2
I rekon that "sealed" modifier is that you a looking for
http://msdn2.microsoft.com/en-us/library/88c54tsw.aspx

but it prohibit this class being inherited

"Water Cooler v2" wrote:
If I recall correctly, in C++ there was an access specifier that could
label a data member of a class as "can be accessed by everyone else
EXCEPT the derived class" -- an accurate opposite of "protected". I
think I allude to the "friend" modifier in C++, which is different from
the C# "friend".

Does C# have any such specifier? Is there a method for a child class to
"not" inherit some properties off its base class?


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

May 16 '06 #3
as far as I understood your question you have following:
a base class with members ( some of them can be overriden some not )
a child class that can inherint base class and override some
members(properies/methods)

there is no such keyword in C# but you can implement this in C# as
declare member that cannot be overriden as non-virtual methods -the
ones that can be overriden will be virtual

in case you have some method in base class and you want completely
different functionality/parameters you can delcare it using new keyword
Hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

May 16 '06 #4
Michael Nemtsev wrote:
I rekon that "sealed" modifier is that you a looking for
http://msdn2.microsoft.com/en-us/library/88c54tsw.aspx

but it prohibit this class being inherited
The original poster is asking about access, not inheritance.
To my knowledge, there is no such modifier in C#. Nor was it
in C++.
"Water Cooler v2" wrote:
If I recall correctly, in C++ there was an access specifier that could
label a data member of a class as "can be accessed by everyone else
EXCEPT the derived class" -- an accurate opposite of "protected". I
think I allude to the "friend" modifier in C++, which is different from
the C# "friend".

Does C# have any such specifier? Is there a method for a child class to
"not" inherit some properties off its base class?

May 16 '06 #5

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

Similar topics

5
by: Andy Jarrell | last post by:
I'm trying to inherit from a specific class that has an overloaded operator. The problem I'm getting is that certain overloaded operators don't seem to come with the inheritance. For example: ...
0
by: source | last post by:
I have a base class called Automobile, and a child class called CAR When I create an object of CAR, it should have all the base class members/fields But when I see the CAR object in quick watch I...
15
by: JustSomeGuy | last post by:
this doesn't want to compile.... class image : public std::list<element> { element getElement(key k) const { image::iterator iter; for (iter=begin(); iter != end(); ++iter) { element...
11
by: Noah Coad [MVP .NET/C#] | last post by:
How do you make a member of a class mandatory to override with a _new_ definition? For example, when inheriting from System.Collections.CollectionBase, you are required to implement certain...
4
by: elziko | last post by:
I would like to do the following: Create a class that inherits from a usercontrol. Then add a control to the designer Call this new class ClassA. Many controls I need will start off like this...
4
by: Xero | last post by:
Hello. I am using vb.net. There are two forms in my project. One is 'base' and the other one is 'savecurrent'. There is a value stored in a textbox called 'qc_a' in 'base'. I want to inherit...
2
by: TJO | last post by:
I am having difficulty understanding why I cannot access my base .ascx class members from my inherited class. I create a base .ascx control and add a method. public partial class...
5
by: dragoncoder | last post by:
I got this code from a friend of mine. #include <iostream> using namespace std; class Base { int i; public:
4
by: AalaarDB | last post by:
struct base { int x, y, z; base() {x = 0; y = 0; z = 0;}; base(int x1, int y1, int z1) {x = x1; y = y1; z = z1;}; }; struct intermediate1 : public virtual base {}; struct intermediate2 :...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.