Home All Groups Group Topic Archive Search About

Not inheriting members from the base

Author
16 May 2006 6:50 AM
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 VB.NET "friend".

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

Author
16 May 2006 7:28 AM
Herfried K. Wagner [MVP]
"Water Cooler v2" <wtr_***@yahoo.com> schrieb:
> 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 VB.NET "friend".
>
> Does VB.NET have any such specifier?

No.

> Is there a method for a child class to "not" inherit some properties off
> its base class?

Basically no, except those properties are marked as 'Private'.  Then they
cannot be accessed by the derived class.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
17 May 2006 4:21 AM
Michael D. Ober
In this case, you'd be better off not using inheritance.  Rather, create a
private class variable of the type you would have inherited from.  If the
base class is marked "must-inherit", create a private class type inside your
class and then create a variable of your intermediate class type.

Doing this will block any inheritance from passing from the base class up
through your class.

Mike Ober.

Show quote
"Water Cooler v2" <wtr_***@yahoo.com> wrote in message
news:1147762218.579520.106020@j73g2000cwa.googlegroups.com...
> 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 VB.NET "friend".
>
> Does VB.NET have any such specifier? Is there a method for a child
> class to "not" inherit some properties off its base class?
>

AddThis Social Bookmark Button