note 47465 deleted from language.oop5.overloading by danielc

From: Date: Thu, 03 Jul 2008 00:32:51 +0000
Subject: note 47465 deleted from language.oop5.overloading by danielc
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141094@lists.php.net to get a copy of this message
Note Submitter: bigtree at DONTSPAM dot 29a dot nl Reason: 0 ---- Keep in mind that the __call method will not be called if the method you are calling actually exists, even if it exists in a parent class. Check the following example: <?php class BaseClass { function realMethod() { echo "realMethod has been called\n"; } } class ExtendClass extends BaseClass { function __call($m, $a) { echo "virtual method " . $m . " has been called\n"; } } $tmpObject = new ExtendClass(); $tmpObject->virtualMethod(); $tmpObject->realMethod(); ?> Will output: virtual method virtualMethod has been called realMethod has been called You might expect that all method calls on ExtendClass will be handled by __call because it has no other methods, but this is not the case, as the example above demonstrates.

« previous php.notes (#141094) next »