ID: 43149
Comment by: crescentfreshpot at yahoo dot com
Reported By: henrik at bonest dot dk
Status: Open
Bug Type: Class/Object related
Operating System: Windows XP
PHP Version: 5.2.4
New Comment:
Smaller Reproduce code:
-----------------------
<?php
abstract class bizView {
abstract public function getHTML();
}
abstract class bizViewFront extends bizView {
abstract public function getHTML();
}
?>
Actual Result:
--------------
Fatal error: Can't inherit abstract function bizView::getHTML()
(previously declared abstract in bizViewFront)
Why one would include the second [duplicate] declaration in the child
class is beyond me.
Previous Comments:
------------------------------------------------------------------------
[2007-10-30 19:10:14] henrik at bonest dot dk
Description:
------------
An abstract class should hold one abstract methods.
The class that implements it, may not be declared abstract, but this
simple structure does not give the results expected
Reproduce code:
---------------
abstract class bizView {
abstract public function getHTML();
}
abstract class bizViewFront extends bizView
{
abstract public function getHTML();
public function somethingelse() {
echo "Something";
}
}
class bizViewOutput extends bizViewFront
{
public function getHTML() {
echo "HTML";
}
}
$test = new bizViewOutput();
$test->getHTML();
Expected result:
----------------
I would expect the text "HTML" to be printed, because the getHTML
function is implemented in the child class but declared abstract in the
base abstract classes.
This is a common OOP practice.
Actual result:
--------------
Fatal error: Can't inherit abstract function bizView::getHTML()
(previously declared abstract in bizViewFront)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43149&edit=1