473,434 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Private inheritance in VB.Net

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
Nov 22 '05 #1
3 1620
In article <ae**************************@posting.google.com >,
fa****@coned.com says...
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.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 22 '05 #2
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" <fa****@coned.com> wrote in message
news:ae**************************@posting.google.c om...
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

Nov 22 '05 #3
TF <fa****@coned.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dave Theese | last post by:
Hello all, The example below demonstrates proper conformance to the C++ standard. However, I'm having a hard time getting my brain around which language rules make this proper... The error...
1
by: Tony Johansson | last post by:
Hello! Private inheritance is sometimes called implementation inheritance. If you use this private inheritance how is with the usage of overriding then. Is overriding used less often when...
6
by: karthikbalaguru | last post by:
Hi, Could someone here tell me some links/pdfs/tutorials to know about the difference between Private Inheritance and Public Inheritance ? I am unable to get info w.r.t it. Thx in advans,...
8
by: puzzlecracker | last post by:
The statement is taken from FAQ . What about non-virtual functions? Can they be overriden? I still don't see a good justification to prefer private inheritance over composition. In fact, I have...
4
by: zhangyefei.yefei | last post by:
i read book <effective c++>,it tell me that public inheritance means is-a ,and private inheritance means is-implemented-in-terms-of. but today i am puzzled by some strange codes. the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.