You are here: Re: How to do "friend class" in php? « PHP Programming Language « IT news, forums, messages
Re: How to do "friend class" in php?

Posted by gosha bine on 07/19/07 10:03

On 18.07.2007 14:14 Toby A Inkster wrote:
> Harrie Verveer wrote:
>
>> Check out the discussion here: http://bugs.php.net/bug.php?id=34044
>
> The comments on that page also include a rather nice way of implementing
> friend classes yourself, though you may also want to overload __call().
>
> Although a little more fiddly, the above method is arguably better than
> C++'s. This is because with a little extra work you could define an
> "acquaintance" class which is, say, the same as a friend class, but has
> read-only access to object properties instead of read-write.
>

Using debug_backtrace to obtain the name of the calling class... well,
this is not what I'd actually call "nice". Looks quite ugly, but so is
the very idea of "friends", so it's fair, at least. ;)



--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

 

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

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