Shared Members

Classes can expose instance and shared members. Until now, all discussions used instance members for examples. It’s important to understand the difference between instance and shared members because you can successfully use both of them in your classes. When you create a new instance of a class, you create a copy of that class with its own life and its own data. On the other hand, with shared members, you work with only one copy of a class and of its data. Classes can support different situations, such as all shared members or just a few shared members. For example, if you have a class exposing only shared members, you work with exactly one copy of the class. If you have only a few shared members within a class, all instances ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.