You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class foo
var a =1def inc()
a = a +1
enddef
Endclass
class bar(foo)
var class ="test"
Endclass
boo =new(foo)
boo.inc() ; incrementing boo.a also increments zap.a?
zap =new(bar)
; zap.a =1
; have to initialize zap.a tonot increment issue above,
; but what is the point of having class variable default values?
; boo.inc() ; putting the call here also seems tonot increment zap.a
zobj = reflect(zap)
loop= iterator(zobj)
While move_next(loop)
name=get(loop)
value = zobj(name)
Printname, " = ", value
Wend
outputs
CLASS = test
A = 2 ; should be 1 since boo.inc() is called, not zap.inc()
...
...
The text was updated successfully, but these errors were encountered:
blazer2k1
changed the title
Class member variable default value questions
Class member variable default value issue
Sep 21, 2023
As demonstrated in the below sample:
outputs
The text was updated successfully, but these errors were encountered: