473,779 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not inheriting members from the base

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?

May 16 '06 #1
2 1291
"Water Cooler v2" <wt*****@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/>

May 16 '06 #2
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.

"Water Cooler v2" <wt*****@yahoo. com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.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?


May 17 '06 #3

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

Similar topics

5
6887
by: Andy Jarrell | last post by:
I'm trying to inherit from a specific class that has an overloaded operator. The problem I'm getting is that certain overloaded operators don't seem to come with the inheritance. For example: // TestA.h --------------------------------------- #include <iostream> enum Aval { FIRST_VALUE,
0
1059
by: source | last post by:
I have a base class called Automobile, and a child class called CAR When I create an object of CAR, it should have all the base class members/fields But when I see the CAR object in quick watch I see bunch of empty lines in my view. Is there anything wrong, why don't I see my base class variables/fields. All of the base class variables and fields are public. Any clue. source
15
1714
by: JustSomeGuy | last post by:
this doesn't want to compile.... class image : public std::list<element> { element getElement(key k) const { image::iterator iter; for (iter=begin(); iter != end(); ++iter) { element &elem(*iter);
11
2168
by: Noah Coad [MVP .NET/C#] | last post by:
How do you make a member of a class mandatory to override with a _new_ definition? For example, when inheriting from System.Collections.CollectionBase, you are required to implement certain methods, such as public void Add(MyClass c). How can I enforce the same behavior (of requiring to implement a member with a new return type in an inherited class) in the master class (similar to the CollectionBase)? I have a class called...
4
1199
by: elziko | last post by:
I would like to do the following: Create a class that inherits from a usercontrol. Then add a control to the designer Call this new class ClassA. Many controls I need will start off like this so I'd like to create all controls form now on from this base control. So, for example, I inherit from this base control and add the further controls required to form this part of my UI. Call this ClassB
4
1365
by: Xero | last post by:
Hello. I am using vb.net. There are two forms in my project. One is 'base' and the other one is 'savecurrent'. There is a value stored in a textbox called 'qc_a' in 'base'. I want to inherit it in 'savecurrent' when a button (located in 'savecurrent') is clicked. So a declared an Object varible, whose name is 'equation' in 'savecurrent' and typed in the following code:
2
1407
by: TJO | last post by:
I am having difficulty understanding why I cannot access my base .ascx class members from my inherited class. I create a base .ascx control and add a method. public partial class myWebControlBase : System.Web.UI.UserControl { public virtual void _foo(){ } }
4
1619
by: Water Cooler v2 | last post by:
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 C# "friend". Does C# have any such specifier? Is there a method for a child class to "not" inherit some properties off its base class?
5
1354
by: dragoncoder | last post by:
I got this code from a friend of mine. #include <iostream> using namespace std; class Base { int i; public:
4
1699
by: AalaarDB | last post by:
struct base { int x, y, z; base() {x = 0; y = 0; z = 0;}; base(int x1, int y1, int z1) {x = x1; y = y1; z = z1;}; }; struct intermediate1 : public virtual base {}; struct intermediate2 : public virtual base
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8961
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5373
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.