Re: Interfaces in PHP
| From: | Brad LaFountain | Date: | Wed, 21 Aug 2002 12:41:11 +0000 |
| Subject: | Re: Interfaces in PHP | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-87227@lists.php.net to get a copy of this message | ||
--- Tim Converse <tim_converse@yahoo.com> wrote:
>
> --- Brad LaFountain <rodif_bl@yahoo.com> wrote:
>
> > 2) Interfaces as they exist in java don't really give you
> > much in a stripting
> > language but if you insist on having something like that
> > you can curently do it
> > with the zend1.
> >
> > class temperature {
> > function __construct($value) {}
> > function toCelcius() {}
> > function toFarenheight() {}
> > }
> >
> > just use that class and extend away....
>
> Brad ---
>
> Not the same thing at all, as I'm sure you know. You
> usually want interfaces in addition to whatever (single)
> inheritance structure you already have.
Well the zend1 example I gave was a workaround. But that is why I said if the
deligation gets worked out in zend2 then you could acually do similar stuff.
BTW I do use some stuff like this in some of my classes. I'll create a function
with no implementation and any extending class can override that method and use
its functionality (usally for event like stuff), so I don't have to call
method_exists() before trying to call the method.
- Brad
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com