Does code in the constructor add to code in subclass constructors?

Posted by Jeremy Rudd on Stack Overflow See other posts from Stack Overflow or by Jeremy Rudd
Published on 2010-04-29T18:54:43Z Indexed on 2010/04/29 18:57 UTC
Read the original article Hit count: 343

Filed under:
|
|
|

Does code in the constructor add to code in subclass constructors? Or does the subclass's constructor override the superclass? Given this example superclass constructor:

class Car{
     function Car(){ 
          trace("CAR")
     }
}

...and this subclass constructor:

class FordCar extends Car{
     function FordCar(){ 
          trace("FORD")
     }
}

When an instance of FordCar is created, will this trace "Car" and "Ford" ??

© Stack Overflow or respective owner

Related posts about beginner

Related posts about oop