December 2001
Intermediate to advanced
360 pages
9h 6m
English
VB .NET introduces the concept of shared members. Shared members are a way of creating a member (a property, procedure, or field) that is shared among all instances of a class. For example, you could create a property for a database connection string. This will be the same for each class, so you can fill it in for one class and all classes can then see that one property. Shared properties are most often used in inheritance, so that all objects created from derived classes can share the same member across all instances of the class. However, shared members also can be used regardless of whether you are using inheritance.
To see how shared properties work, suppose that you wanted to create a logging mechanism to record any kind of ...