Re: Interfaces and Access Levels
| From: | Jason Barnett | Date: | Wed, 29 Dec 2004 14:37:47 +0000 |
| Subject: | Re: Interfaces and Access Levels | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205297@lists.php.net to get a copy of this message | ||
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 {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=2function do_something_internal();} class bar implements foo { private function do_something_internal() {// I would like this to be private} }