note 51123 deleted from language.oop5 by googleguy

From: Date: Tue, 15 Jan 2013 04:40:57 +0000
Subject: note 51123 deleted from language.oop5 by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193044@lists.php.net to get a copy of this message
Note Submitter: spam at afoyi dot com ---- You can call a function defined in an inherited class from the parent class. This works in both PHP 4.3.6 and 5.0.0: <?php class p { function p() { print "Parent's constructor\n"; } function p_test() { print "p_test()\n"; $this->c_test(); } } class c extends p { function c() { print "Child's constructor\n"; parent::p(); } function c_test() { print "c_test()\n"; } } $obj = new c; $obj->p_test(); ?> Outputs: Child's constructor Parent's constructor p_test() c_test()

« previous php.notes (#193044) next »