Really baffled with this one,
@atilim,
@ar2rsawseenI have a:
a = Core.class(Sprite)
function a:init()
print ("init a")
end
b = Core.class(a)
function b:init()
print("init b")
end
local aa = a.new() -- should print "init a"
local bb = b.new() -- should print "init b"? |
produces:
I expect the "local b=b.new()" line to only print "init b".
I'm seeing Gideros merge the two methods, so both a.init and b.init execute.
However, I see "init a" then "init b", e.g. the order makes overriding methods impossible.
I'd expect when overriding a method, to call the parent explicitly. (e.g. b:init() would call a:init() explicitly)
Can someone advise on:
1. why the implicit call to a:init()
2. when doing a b.new(), why is a:init() executed first?
3. is method overriding possible at all?
Comments
this does work, thank you very much!
I've never seen postInit() in the documentation??
Glad it helped I am not sure either... at that time a lot of things were happening/changing through the forums and it was the primary source of informations.
Probably @ar2rsawseen could give us a directly link to the documentation covering that aspect so the discussion can be the definitive source of informations on that topic.