[Flashcoders] AS 2.0 constructor inheritance

2007-08-14 Thread Alan MacDougall
Compare these two situations: class SuperClass { private var list:Array; public function SuperClass() { list = new Array(); } } class SubClass extends SuperClass { // when instantiated, the list variable is automatically initialized } This is as it should be. The

Re: [Flashcoders] AS 2.0 constructor inheritance

2007-08-14 Thread Johannes Nel
the constructer gets invoked automatically (and its the only function which does all other overrides this is not the case for) but the super class's constructer is being called without arguments so whats happening on a code level is this super(); On 8/14/07, Alan MacDougall [EMAIL PROTECTED]

Re: [Flashcoders] AS 2.0 constructor inheritance

2007-08-14 Thread Hans Wichman
Hi, when the superclass has a default contructor without parameters, there is no need to call it explicitly. I'd like to turn it around though, no matter what or how you have defined them, always call them explicitly for clarity's sake and self documentation. greetz JC On 8/14/07, Alan

Re: [Flashcoders] AS 2.0 constructor inheritance

2007-08-14 Thread Ian Thomas
On 8/14/07, Alan MacDougall [EMAIL PROTECTED] wrote: My understanding of inheritance is that I should not need to explicitly call the superclass constructor as long as I'm not overriding or extending that method of the superclass. What gives? Is it a language quirk? Nope, not a language

Re: [Flashcoders] AS 2.0 constructor inheritance

2007-08-14 Thread Alan MacDougall
Hans Wichman wrote: Hi, when the superclass has a default contructor without parameters, there is no need to call it explicitly. I'd like to turn it around though, no matter what or how you have defined them, always call them explicitly for clarity's sake and self documentation. So if the

Re: [Flashcoders] AS 2.0 constructor inheritance

2007-08-14 Thread Matthias Dittgen
Interesting thread, Alan! What is ECMA Specification saying to that situation? Matthias slightly OT, but I have noticed some time ago, that Flash IDE claims the super() call to be the first line in the constructor of the extending class. But I noticed to the same time, that when compiling with