Does New() chain back to super etc.
BlitzMax Forums/BlitzMax Beginners Area/Does New() chain back to super etc.
| ||
If I initialize stuff in new() does it work back up the inheritance chain. I tried: type fruit field fruitIndex:int method new() fruitIndex=4 end method end type type citrus extends fruit field issour:int method new() super.new() issour=5 end method end type but it won't take super.new() so what is the trouble? Does it chain back on new automatically? thanks in advance Last edited 2012 Last edited 2012 |
| ||
Does it chain back on new automatically? Yes. "Super.New" (if it were to exist by that name) is automatically called first, the the local New. This happens all the way down the inheritance chain, so the first thing called will be "Object.New". |
| ||
thanks yasha |