Re: overprotective?
| From: | Lukas Smith | Date: | Wed, 06 Apr 2005 11:44:41 +0000 |
| Subject: | Re: overprotective? | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-37111@lists.php.net to get a copy of this message | ||
Robin Ericsson wrote:
lets say I have class base { private $extended; public function foo() {Aside from this there is one serious drawback to labeling things with private/protected. When using __call() to dynamically add functionality through objects that are created ondemand and stored as properties you quickly run into problems. There visibility "package" would probably be wiser to use, even if its not supported in PHP5 (and therefore can only be noted via an @access phpdoc comment).Not really sure what you mean here :)
$this->bar();} private function bar() {
echo 'bar';} } and then I refactor the class to load code on demand class base { private $extended; public function foo() {
$this->bar();} public function __call($method, $params) {
call_user_func_array(array(&$this->extended, $method), $params);} } class extended { // needs to be come public now ... private function bar() {
echo 'bar';} } regards, Lukas