Not inheriting members from the base

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?
 
H

Herfried K. Wagner [MVP]

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.
 
M

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top