|
Both method calls and member accesses can be overloaded via the __call, __get and __set methods. These methods will only be triggered when your object or inherited object doesn't contain the member or method you're trying to access.
Class members can be overloaded to run custom code defined in your class by defining these specially named methods. The $name parameter used is the name of the variable that should be set or retrieved. The __set() method's $value parameter specifies the value that the object should set set the $name.
Class methods can be overloaded to run custom code defined in your class by defining this specially named method. The $name parameter used is the name as the function name that was requested to be used. The arguments that were passed in the function will be defined as an array in the $arguments parameter. The value returned from the __call() method will be returned to the caller of the method.
Przykład 19-19. overloading with __call example
Powyższy przykład wyświetli:
|
Poprzedni | Spis treści | Następny |
Object Interfaces | Początek rozdziału | Object Iteration |
Hosting by: Hurra Communications Sp. z o.o.
Generated: 2007-01-26 18:02:56