Dinamically adding methods to an object instance?
| From: | Francisco M. Marzoa Alonso | Date: | Mon, 15 Nov 2004 17:56:38 +0000 |
| Subject: | Dinamically adding methods to an object instance? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202050@lists.php.net to get a copy of this message | ||
I've seen that's possible to add public members to objects dinamically, such as:
<?php
class TestClass {
public $One=1;
}
$Obj = new TestClass ();
$Obj->Two = 2;
echo $Obj->Two;
?>
There'll be a public "Two" member that's not defined in the class.
Is it possible to add methods dinamically to an object instance in same way? how? will these methods have access to private and protected members of the class of the object?
Thanks a lot in advance...