note 95373 deleted from language.oop5.overloading by thiago
| From: | thiago@php.net | Date: | Tue, 29 Dec 2009 18:59:25 +0000 |
| Subject: | note 95373 deleted from language.oop5.overloading by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164448@lists.php.net to get a copy of this message | ||
Note Submitter: php at keith tyler dot com
----
To respond to a previous comment:
Yes, you could use __call to implement method polymorphism, but it's real purpose is for
dynamic method generation (class polymorphism, perhaps?).
If you don't need dynamic method *names*, you can implement method polymorphism a lot more
easily via the func_get_args() function within the declared method, for example:
class Foo {
public function bar() {
$c=count(func_get_args());
print "You called bar with $c arguments: ".join(",
",func_get_args()."\n";
}
}