Thanks - I just wanted to know what the 'official scope/behavior of a static variable was. I couldn't care less about the example; it was just an example after all :)

On Jan 10, 2007, at 9:17 AM, [EMAIL PROTECTED] wrote:

On Jan 10, 2007, at 01:23 UTC, Malcolm Smith wrote:

Well it appears that a static variable is shared across all instances
(based on some simple test code).

That's right.  A static variable is exactly like a global variable,
except that it can only be accessed within the method where it's
defined.

On Jan 9, 2007, at 5:08 PM, Tom Benson wrote:

I honestly don't know, but I'd be really surprised if static
variables were not instance bound.

If I increment a static variable in one object instance, I would
not likely want it to be increased in all other instances of that
object.

The above is standard behaviour for most other languages I can
think of.

Like what?  In all the languages I know with the concept of a static
variable, the behavior is exactly the same as in RB.

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to