|
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]
|