|
-
Mar 10th, 2004, 06:54 PM
#1
Thread Starter
Hyperactive Member
Shared variables, properties and events
Hi, I am just reading up about using shared variables, properties and events when creating classes in .NET.
The book shows me how do to this but I would like to be given some real life examples of when and why I would make a variable shared..
The basic example they give is a shared variable counter that displays how many objects you have created from a given class.
That's all very nice but a pretty lame example I think. What else would I use a shared variable for when defining a class??
Thanks
Mark
-
Mar 11th, 2004, 12:00 AM
#2
The purpose of using Shared scope is when the member doesn't relate to an instance. So use it with anything that doesn't require an instance of the object.
Last edited by Edneeis; Mar 14th, 2004 at 04:20 AM.
-
Mar 14th, 2004, 04:05 AM
#3
Thread Starter
Hyperactive Member
Thanks for your help Edneeis
Cheers
MarkusJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|