Not inheriting members from the base

  • Thread starter Thread starter Water Cooler v2
  • Start date Start date
W

Water Cooler v2

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?
 
which is different from the C# "friend".

I meant to say, _different from the C# "internal"._
 
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 said:
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
 
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
 
Back
Top