Walter Meester
HoogkarspelNetherlands
Silvain,
>I admit that I don't see many uses for a static variable, but they can be usefull and respect a good OO design (IMHO). An example from the top of my head: let say that you have a class that cannot be instanciated more than once. Without a static variable, you need to create a public variable or something like that. Not very OOP. With a static variable, you could create it in the class, initialize it at .T. in the Init() and put it at .F. in the Release(). That way, the class encapsulate this behaviour and respect good OO design.
You mean that you'll have counter in the class to prevent multiple instances ?
If so, I don't think this will work, If you create another instance of a class this class creates it's own static variable with it's own (thus different from the otherone) scope.
Since a static variable can only exist in the code where it was created (or in succesive called procs or methods, if the scope is private) you'll have to create it in the class itself.
Maybe someone has a better example where static variable can be of use...
Walter,
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only