|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-26 17:34 UTC] wez@php.net
[2004-04-26 17:43 UTC] dcahh at gmx dot de
[2004-07-29 04:08 UTC] ah08010-zend at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 08:00:01 2025 UTC |
Description: ------------ I can't have an abstract class provide it's functions protected to it's child classes, since I'm able to declare only public functions within an interface. Reproduce code: --------------- <?php interface AnyClassInterface { protected function doSomething ($sTest); } abstract class AnyClassAbstract { protected function doSomething ($sTest) { echo $sTest; } } class AnyClass { public funtion __construct() { $this->doSomething ('Hello World'); } } $oAnyObject = new AnyClass(); ?> Expected result: ---------------- One should be able to declare a function in an interface to be protected, so that classes extending the abstract class, which is implementing the interface is able to provide it's functions only to child-classes and to protect them from foreign classes. Actual result: -------------- Fatal error: Access type for interface method AnyClassInterface::doSomething() must be omitted or declared public in D:\apache-webroot\test\testphp\php5.php on line 5