note 46155 added to language.oop5.overloading

From: Date: Fri, 01 Oct 2004 01:52:10 +0000
Subject: note 46155 added to language.oop5.overloading
Groups: php.notes 
Request: Send a blank email to php-notes+get-77644@lists.php.net to get a copy of this message
Sharp readers (i.e. C++, Java programmers, etc.) may have noticed that the topic of "Overloading" mentioned in the documentation above really isn't about overloading at all... Or, at least not in the Object Oriented Programming (OOP) sense of the word. For those who don't already know, "overloading" a method (a.k.a. function) is the ability for functions of the same name to be defined within a Class as long as each of these methods have a different set of parameters (each method would have a different "signature", if you will). At run-time, the script engine could then select and execute the appropriate function depending on which type or number of arguments were passed to it. Unfortunately, PHP 5.0.2 doesn't support this sort of overloading. The "Overloading" mentioned above could be better described as "Dynamic Methods and Properties"... By using "Dynamic Methods and Properties", we can make our class instances "appear" to have methods and properties that were not originally present in our Class definitions. Although this is a great new feature (which I plan to use often), through the use of "__get", "__set", and "__call", we can also emulate "real" overloading as shown in a few of the code examples below. ---- Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46155 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46155&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46155&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77644) next »