|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-22 08:44 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 18:00:01 2025 UTC |
Description: ------------ When we inherit classes and creates an object of derieved class the constructor of parent classes are not executed we need to execute this explicitly. Please check the following code Reproduce code: --------------- <?php abstract class a { function __construct() { print "a"; } } class b extends a { function __construct() { print "b"; } } class c extends b { function __construct() { print "c"; } } $v = new c(); ?> Expected result: ---------------- abc but it ab getting on c why so? as inheritance moves form parent to child same as java. Actual result: -------------- c