You are here: Re: php 5 classes: public, protected and private « PHP Programming Language « IT news, forums, messages
Re: php 5 classes: public, protected and private

Posted by Michael Fesser on 12/01/06 14:39

..oO(Tony Marston)

>> Just an example: Without
>> these interfaces it wouldn't be possible to use 'foreach' to iterate
>> over any arbitrary object:
>>
>> foreach ($directory as $file) {...}
>> foreach ($resultSet as $record) {...}
>
>With PHP 5 it is possible to use 'foreach' on an object without the use of
>interfaces, so your argument is not valid.

It's a huge difference whether you just loop through all of the object's
properties like an array (that's what you described above) or if each
iteration automatically calls a particular method, which for example
fetches the next record from a database.

The latter is the basis of the SPL extension and not possible without
interfaces. Maybe IYHO the entire extension is not valid as well?

Micha

 

Navigation:

[Reply to this 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

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