Re: Interface inheritance
| From: | Shane Caraveo | Date: | Mon, 19 Apr 2004 15:52:35 +0000 |
| Subject: | Re: Interface inheritance | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9384@lists.php.net to get a copy of this message | ||
Zeev Suraski wrote:
At 13:28 19/04/2004, Christian Schneider wrote:Zeev Suraski wrote:Everything means for both overriding a method and implementing an interface/abstract method.1. First of all, I agree that in a perfect world we should go with E_COMPILE_ERROR for everything. Maybe now that's constructors are outI'm not sure I understand what you mean by everything.
In my opinion it doesn't, because it breaks the interface of the parent class. I.e., you can no longer use code you've written to work with an object of the parent class, with an object of the child class, which breaks one of the most fundamental principals of OO. In turn, it renders class type hints useless, because the fact that you have an object of type Foo gives you very little - you have no idea what its interface is, because Bar, derived from Foo, can have a completely different interface.I think using a compile error for interface/abstract class issues is a *very* good thing, but turning inheritance into an interface is not. If someone wants to know that a particular class instance has a predefined interface, use an interface. Shane