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 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?
 
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 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.
 
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.
 
Back
Top