Bug #35057 [Com]: abstract method inheritance and interface implementation problem
| From: | lsmith@php.net | Date: | Thu, 02 Feb 2012 22:02:58 +0000 |
| Subject: | Bug #35057 [Com]: abstract method inheritance and interface implementation problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167075@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=35057&edit=1
ID: 35057
Comment by: lsmith@php.net
Reported by: antonsub at pochtamt dot ru
Summary: abstract method inheritance and interface
implementation problem
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.1.0RC4
Block user comment: N
Private report: N
New Comment:
see #43200
Previous Comments:
------------------------------------------------------------------------
[2005-11-01 21:53:46] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
B::foo is not A::foo, so when C inherits B it gets B::foo and when it implements A it gets A:foo,
obviously A::foo and B::foo are different. That\'s what the error tells you.
------------------------------------------------------------------------
[2005-11-01 21:12:39] antonsub at pochtamt dot ru
Description:
------------
Code given produces fatal error:
Can't inherit abstract function A::foo() (previously declared abstract in B) in foo.php on line
20
Reproduce code:
---------------
<?php
interface A
{
public function foo($id);
}
abstract class B
{
abstract public function foo($id);
}
class C extends B
{
public function foo($id)
{
echo "foo\n";
}
}
class D extends C implements A {}
var_dump(new D);
?>
Expected result:
----------------
But is expected to run cleanly.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=35057&edit=1