Hello out there,
look at the following sample:
---
catch {Sample destroy}
oo::class create Sample {
variable classVar ;# automatically exists in every instance
constructor {someVar} {
my variable objVar
set classVar $someVar
set objVar 99
}
destructor {
my variable objVar classVar
puts "classVar: $classVar, objVar: $objVar"
}
}
Sample create s1 100
Sample create s2 200
s1 destroy ;# -> classVar: 100, objVar: 99
s2 destroy ;# -> classVar: 200, objVar: 99
---
My question is: What happens, if I add 'classVar', although not
needed, to a 'my variable' statement - like I did in the destructor
above. Is it just superfluous or can it have consequences in a more
complex situation than the above example.
Thank you for any enlightenment
Helmut
Grok was very clever explaining the current code, but it was wrong
trying to depict a more complex case.
"classVar" is not a class-variable (despite its name).
Simply Tcloo has not (yet) a concept of class-variables. All the
variables are instance-variables,
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,028 |
Nodes: | 10 (0 / 10) |
Uptime: | 130:43:08 |
Calls: | 13,329 |
Calls today: | 1 |
Files: | 186,574 |
D/L today: |
496 files (122M bytes) |
Messages: | 3,355,343 |