Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_compile.c
| From: | Andi Gutmans | Date: | Sun, 08 Dec 2002 17:46:36 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_compile.c | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-697@lists.php.net to get a copy of this message | ||
This is exactly right. It makes sense to allow a derived class to increase visibility but to decrease is a no-no. Like Stas said it would kill the "is-a" relationship.
Andi
At 04:47 PM 12/8/2002 +0200, Stanislav Malyshev wrote:
MB>> Therefor i would vote for allowing only decreasing the visibility or force MB>> to keep it. Decreasing visibility contradicts the basic inheritance principle - that derived class "is-a" base class, i.e., basically, it can be used in any place the base class is used. If you restrict methods in derived class, it may lead to a situation where $foo->method() works with base class, but fails with derived class - which is, as I said, against the inheritance principle. As for increasing visibility - I don't see major problem in it. What could be the problem if derived class is allowed to open protected method to public? After all, it could proxy it anyways... -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.109 -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php