Re: wrong behaviour with is_subclass_of() ??
| From: | Stut | Date: | Fri, 19 Sep 2008 15:10:35 +0000 |
| Subject: | Re: wrong behaviour with is_subclass_of() ?? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280508@lists.php.net to get a copy of this message | ||
On 19 Sep 2008, at 15:58, Johannes Mueller wrote:
Stut wrote:A implements I therefore A *is not* a subclass of I. B extends I therefore B *is* a subclass of I. In the case of A it's simply stating that it implements every method defined by I. B on the other hand does not necessarily implement the methods defined in I, but those methods will still be available on instances of B but the code in I will be used. I don't see what's difficult to understand here. -Stut -- http://stut.net/But B is also no subclass of I - it just implements I as well as A. So there could be two possible straight solutions: 1. Neither A nor B is a subclass of I. 2. Both A and B are subclasses of I.outputs: B implements I I would expect the following output: A implements I B implements IBecause there is a big difference between extends and implements, one of which being that the class is not considered to be a subclass of an interface it implements. Seems entirely logical to me.