Private inheritance in VB.Net

  • Thread starter Thread starter TF
  • Start date Start date
T

TF

Hi,
There isn't anything like 'Private Inheritance' in VB.Net. Then how
can we hide a Public method of the Base class from the user of its
Inherited class?

TF
 
Hi,
There isn't anything like 'Private Inheritance' in VB.Net. Then how
can we hide a Public method of the Base class from the user of its
Inherited class?

I beleive you can do what you want with the 'Shadows' keyword.
 
The CTS doesn't allow this, so none of the managed languages do support
Private Inheritance.
However, the same can be achieved with composition and delegation.
Additionaly you can mark your delegation methods as sealed, to ensure that
they are not overriden in subclasses.

Willy.
 
TF said:
There isn't anything like 'Private Inheritance' in VB.Net. Then how
can we hide a Public method of the Base class from the user of its
Inherited class?

You can't (I believe) and you shouldn't (in my opinion) as that
violates Liskov's Substitutability Principle.
 
Back
Top