ID:               28158
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dcahh at gmx dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: XP Pro
 PHP Version:      5CVS-2004-04-26 (dev)
 New Comment:

interfaces are, by definition, public.
Abstract classes are not the same as interfaces.


Previous Comments:
------------------------------------------------------------------------

[2004-04-26 15:44:22] dcahh at gmx dot de

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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=28158&edit=1

Reply via email to