note 57866 added to language.oop5.interfaces

From: Date: Mon, 17 Oct 2005 09:29:57 +0000
Subject: note 57866 added to language.oop5.interfaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-97110@lists.php.net to get a copy of this message
Interfaces and Type Hinting can be used but not with Inherintance in the same time : <? class AbstractClass { public function __ToString ( ) { return 'Here I\'m I'; } } class DescendantClass extends AbstractClass { } interface MyI { public function Hello ( AbstractClass $obj ); } class MyClassOne implements MyI { public function Hello ( AbstractClass $obj ) { echo $obj; } } // Will work as Interface Satisfied class MyClassTwo implements MyI { public function Hello ( DescendantClass $obj ) { echo $obj; } } // Will output a fatal error because Interfaces don't support Inherintance in TypeHinting //Fatal error: Declaration of MyClassTwo::hello() must be compatible with that of MyI::hello() ?> Something a little bit bad in PHP 5.0.4 :) ---- Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57866 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57866&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57866&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97110) next »