'cos in every class unless you make an explicit call to super there
is an automatic implicit call to super() before anything else
executes in the subclass constructor.
The explicit call to super can include params as in super(x) if the
superclass has such a constructor.
One gotcha is if you extend a class that has a constructor that takes
an argument and decide not to override the constructor then you
extend that class you cant call super with an argument anymore ie
public class classA{
function classA(xx:int){}
...other stuff...
}
public class classB extends classA{
...only other stuff is overridden...
}
public class classC extends classB{
function classC(xx:int){
super(xx);//compile error.... no such constructor in classB
..do some stuff..
}
}
--- In [email protected], "Firdosh Tangri" <[EMAIL PROTECTED]>
wrote:
>
> hey guys
> I have a class
>
> public class ClassA{
>
> public function ClassA(){
> trace("classA constructor");
> }
>
> }
>
> ===========================================================
>
> public class ClassB extends ClassA{
>
> public function ClassB (){
> trace("classB constructor");
> }
>
> }
>
> ===================================================================
>
>
> when I do
>
> var c:ClassB = new ClassB();
>
>
> why do both the statements get traced out even though I am not
calling super
>
> cheers
> firdosh
>