Re: Why i believe we need final
| From: | Stanislav Malyshev | Date: | Wed, 29 Jan 2003 08:46:19 +0000 |
| Subject: | Re: Why i believe we need final | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93757@lists.php.net to get a copy of this message | ||
MB>> Sure it cannot because insert cannot. The problem and the error you did
MB>> above is that you split an operation into two. Your real operation is
MB>> insert_with_password and that is different from insert. Again insert is an
That's the whole point of OO - to allow overloading the same operation, so
even classes that do not know about implementation details could use it.
MB>> as a member and not as a base class. Maybe it is now a good thing to
MB>> have a generalised container interface and declare insert in the container
MB>> implementations final. Highly specialised containers would then inheritd
I do not see why should container interface be final.
MB>> A class that is derived from a concrete container may in some container
MB>> implementations have final functions. For example whatever inherits a fifo
Still have no explanation why anyone would need it. Just to disallow
overriding "because we can"? I see no added value in that.
MB>> If you have another insert implementation in a class than you
MB>> missused inheritance. If the operation is different than your derived
MB>> class is no for example no longer a fifo. Instead it uses a fifo.
Implementation can be different and still be a fifo. That depends on
overriding implementation.
Again, I still have yet to see any example where the proposed 'final'
plays substantial role and not just is there because 'maybe someone might
want to use it'.
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.109