Gerard Samuel wrote:
I would like bar::do_something_internal() to have an access level of *private*
But this would fail, as the interface can only have *public* methods.
Is there a way to get bar::do_something_internal() to be private?
Or am I SOL, and it has be public?
Thanks


interface foo
{
    function do_something_internal();
}

class bar implements foo
{
   private function do_something_internal()
   {
       // I would like this to be private
   }
}

Interfaces, at least as far as PHP is concerned, is kind of like the "minimum standard" for an API. An interface is a contract with the outside world only... no promises on how the work gets done be it one big function or several internal functions to help it.


I simply don't understand why you want to require a class to have a method that will never be accessed outside of the class. Perhaps using abstract classes / protected methods will work for your purpose?
http://php.net/manual/en/language.oop5.abstract.php




--
Teach a person to fish...

Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to