|
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-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Feb 08 16:00:01 2026 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