note 46980 deleted from language.oop5.decon by nlopess

From: Date: Fri, 29 Oct 2004 19:55:56 +0000
Subject: note 46980 deleted from language.oop5.decon by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79327@lists.php.net to get a copy of this message
Note Submitter: ravindra at gatewaytechnolabs dot com ---- Different behaviour as compare to java and C# For Constructor. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <?php class staticex { function __construct() { print "In BaseClass constructor<BR>"; print "test"; } } class subex extends staticex { function __construct() { print "sub class constructor"; } } $s1=new subex(); ?> Output in above program is :sub class constructor If Subclass has a constructor then super class constructor is not called. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <?php class staticex { function __construct() { print "In BaseClass constructor"; } } class subex extends staticex { } ?> ------------------------------------------------------- ------------------------------------------------------ Output in above program is :In BaseClass constructor If Subclass does not have a constructor then super class constructor is called otherwise not. ---- Reason: useless example

« previous php.notes (#79327) next »