note 17494 modified in keyword.extends by danbrown

From: Date: Wed, 17 Jun 2009 19:10:30 +0000
Subject: note 17494 modified in keyword.extends by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157039@lists.php.net to get a copy of this message
if the class B that extends class A does not have a constuctor function (i.e. a function named B), then the constructor function of A will be used instead, you don't need to make a constructor in B just to call the constructor of A. For example: <?php class A { function A() { echo "HEY! I'm A!\n"; } } class B extends A { } $b = new B(); ?> produces the output: HEY! I'm A! --was-- if the class B that extends class A does not have a constuctor function (i.e. a function named B), then the constructor function of A will be used instead, you don't need to make a constructor in B just to call the constructor of A. For example: class A { function A() { echo "HEY! I'm A!\n"; } } class B extends A { } $b = new B(); produces the output: HEY! I'm A! http://php.net/manual/en/keyword.extends.php

« previous php.notes (#157039) next »