note 95373 added to language.oop5.overloading

From: Date: Tue, 29 Dec 2009 18:49:13 +0000
Subject: note 95373 added to language.oop5.overloading
Groups: php.notes 
Request: Send a blank email to php-notes+get-164447@lists.php.net to get a copy of this message
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"; } } ---- Server IP: 69.147.83.197 Probable Submitter: 174.46.204.210 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php Edit -- https://master.php.net/note/edit/95373 Del: integrated -- https://master.php.net/note/delete/95373/integrated Del: useless -- https://master.php.net/note/delete/95373/useless Del: bad code -- https://master.php.net/note/delete/95373/bad+code Del: spam -- https://master.php.net/note/delete/95373/spam Del: non-english -- https://master.php.net/note/delete/95373/non-english Del: in docs -- https://master.php.net/note/delete/95373/in+docs Del: other reasons-- https://master.php.net/note/delete/95373 Reject -- https://master.php.net/note/reject/95373 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164447) next »