Reply to [Fwd: Re: [PHP] php 5 interfaces]

Your name:

Reply:


Posted by Jochem Maas on 01/21/05 12:56

Tbird switched the reply and reply-all buttons again ;-)...

> ?>
> IMHO its normally to use access type for methods declaration in interfaces. Why not?
> Maybe my first example was not sufficiently illustrative. But my question was "why it does not work in one environment and work fine in another".

it worked for a while because it was originally overlooked, then they
'fixed' it. -- you may not agree with the devs.

> The problem has acquired when i try to add "static" in my interface definition. I don't think that this is a bug in PHP.
> I just want to be deep insight in OOP of PHP5 engine.
>

your right, its not a bug - although some have argued that its Sucks(tm).

in short it was decided by the devs that interfaces are not meant for
static classes, they only apply to objects - which is why 'static' is
not (no longer) allowed on interface methods. if you want to know more
then digging into the php internals mailing list archives will give you
long discussions and justifications as to why it works they way it does.

if you think about it you can see where they are coming from: passing
around classes (i.e. classNames) and then checking whether said class
implements something is really odd, instead you pass around objects.

or more simply:

class == blueprint
object == house

you can interface with a house (lets hope your house IMPLEMENTS a door
interface!) but you can't interface with a blueprint (possibly with the
piece of paper it may be printed on but not with the actual blueprint)
because the blueprint is an idea/concept.

hope that helps you to understand the rationale.

rgds,
JOchem

>

....

>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация