473,405 Members | 2,310 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,405 software developers and data experts.

a sharde member variable in base class

Is this variable shared among all of the instances of the base class and derived classes?

Class Person
Shared Id as String
Shared Function GetId() as String
Return Id
End Function
End Class

Class Emp1 : Inherits Person
End Class

Class Emp2 : Inherits Person
End Class
..
..
..

Dim e1 as New Emp1
Dim e2 as new Emp2

'Are e1 and e2 sharing the same id?

Thanks.
Nov 20 '05 #1
2 895
Yes.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada

"John" <Jo**@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
Is this variable shared among all of the instances of the base class and derived classes?
Class Person
Shared Id as String
Shared Function GetId() as String
Return Id
End Function
End Class

Class Emp1 : Inherits Person
End Class

Class Emp2 : Inherits Person
End Class
.
.
.

Dim e1 as New Emp1
Dim e2 as new Emp2

'Are e1 and e2 sharing the same id?

Thanks.

Nov 20 '05 #2
"John" <Jo**@discussions.microsoft.com> schrieb
Is this variable shared among all of the instances of the base class
and derived classes?

Class Person
Shared Id as String
Shared Function GetId() as String
Return Id
End Function
End Class

Class Emp1 : Inherits Person
End Class

Class Emp2 : Inherits Person
End Class
.
.
.

Dim e1 as New Emp1
Dim e2 as new Emp2

'Are e1 and e2 sharing the same id?


No, not e1 and e2 are sharing the same id, but *class* Person has exactly
one ID - even without e1 and e2.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3

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

Similar topics

1
by: none | last post by:
Hi, I have a base class with a pointer-to-member function variable. Then I have a derived class that needs to use that variable to call a member function (with the same arguments and return value...
5
by: Bob | last post by:
I want to find a way to detect the existance of the private member of a particular type in the derived class from inside the base class itself and call its Dispose() method. Reflection GetFields()...
2
by: Mark Sisson | last post by:
Hi all. SITUATION ================ 1. I have a base class with a member variable that's an object 2. I have several classes that inherit from the base class. 3. There are several methods in...
10
by: Dennis Jones | last post by:
Hello, I have a hierarchy of classes in which there will be a data element that is common to all descendant classes. This element (a string in this case) is constant, but specific to each...
15
by: Bob Johnson | last post by:
I have a base class that must have a member variable populated by, and only by, derived classes. It appears that if I declare the variable as "internal protected" then the base class *can*...
5
by: Ralfeus | last post by:
Hi all. I have a base class and several classes inherited from this base class. I need to create a instances counter for each class. I thought about something like creation of virtual static...
4
by: RSH | last post by:
Hi, I have a situation where I have a class which manages different data connections. In trying to enforce encapsulation I have a member field called connection which could be a type of...
3
by: Goran | last post by:
Hi @ all! Is it possible to overload a member variable? Example: class ClassA_t {
3
by: Immortal Nephi | last post by:
The rule of inheritance states that you define from top to bottom. Sometimes, you want to define base class and set reference from dervied class to base class, but you violate the rule. Here is an...
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
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,...
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,...
0
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...
0
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
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...

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.