a sharde member variable in base class

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
John said:
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
 
Back
Top