Re: Why i believe we need final
| From: | (Marcus Börger) | Date: | Wed, 29 Jan 2003 23:20:45 +0000 |
| Subject: | Re: Why i believe we need final | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93785@lists.php.net to get a copy of this message | ||
At 09:46 29.01.2003, Stanislav Malyshev wrote:
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'.Hey YOU are the example you are looking for. Think i earn money by designing class and data models and in that i know that i cannot modell the world and as a result i create modells which are no "all-in-one devices suitable for everything" (german: eier-legende-wollmilchsau) and even capable of beeing missused for that by inheritance. And at those points where i know of the simplications and restrictions and compromises i made i *may* decide a function to be "final". If you want real life examples (and surely it seems you will never trust me) get yourself a book from scott meyers (going to my bookshelf) "effective c++" and "more effective C++" and read something about programming....and remeber C++ has no final it only has virtual and non virtual (and it also has abstract with default implementation (the other discussion where i said is possible and valuable to think about)). If you don't like C++ get you a theory book or any good book about another language....(written by someone who has understood OOP). Sorry but i guess the discussion does not make any more sense. marcus