note 48234 deleted from language.oop5.static by cmb

From: Date: Sun, 01 Sep 2019 07:22:00 +0000
Subject: note 48234 deleted from language.oop5.static by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212047@lists.php.net to get a copy of this message
Note Submitter: michael at digitalgnosis dot removethis dot com ---- Here's another way to do the same thing (see my post below) without having to muck up your Foo() function's parameters in the Base and all Derived classes. However, you cannot use static, and still must define Foo() in derived classes. This way also performs slower and may not always work--but it DOES make for prettier code. <?php class Base { function Foo () { $call = debug_backtrace(); call_user_func(array($call[1]['class'],'Bar')); } } class Derived extends Base { function Foo () { parent::Foo(); } function Bar () { echo "Derived::Bar()"; } } Derived::Foo(); ?>

« previous php.notes (#212047) next »