ID: 44033
User updated by: giorgio dot liscio at email dot it
Reported By: giorgio dot liscio at email dot it
Status: Open
Bug Type: Feature/Change Request
Operating System: Irrelevant
PHP Version: 5.2.5
New Comment:
the requested behavior can works with multiple abstract inheritance
abstract class One
{abstract function m(){echo("one ");}}
abstract class Two extends One
{abstract function m(){parent::m();echo("two ");}}
abstract class Three extends Two
{abstract function m(){parent::m();echo("three ");}}
class RealClass extends Three
{
function m(){parent::m();echo("real implementation");}
}
Previous Comments:
------------------------------------------------------------------------
[2008-02-03 18:57:02] giorgio dot liscio at email dot it
Description:
------------
hello
i think can be useful make working abstract methods body in abstract
classes
please read carefully ;) i hope you like it
thank you for your time
Reproduce code:
---------------
<?php
abstract class Base
{
abstract protected function commonCheck()
{
echo("WOW! ");
}
}
class Real extends Base
{
// there I MUST implement the abstract method in all cases
// the implementation can consists:
// 1 - in one new procedure,
// 2 - in parent method calling (used the abstract body like a
model)
// 3 - both
protected function commonCheck()
{
parent::commonCheck();
echo("IT IS WORKING!");
}
}
?>
Expected result:
----------------
echo("WOW ");
echo("IT IS WORKING!");
Actual result:
--------------
Fatal error: Abstract function Base::commonCheck() cannot contain body
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44033&edit=1