You are here: Re: how to clone a class? « PHP Language « IT news, forums, messages
Re: how to clone a class?

Posted by C. on 04/22/07 14:24

On 21 Apr, 22:16, "_mario.lat" <n...@libero.it> wrote:
> Hallo,
> I have a class A to manage a grout of classes B.
> (for example "Class Garden" and "Class Flower" which are in garden)
> If i clone A (Garden) I'd like to clone also B (Folwers).
> How cn I do?
> thank you in advance,
> Mario


Presumably you've got references to flower objects in your garden
instance - the simplest way to get a deep clone is to serialize it:

$deep_clone=unserialize(serialize($garden));

There may be a smarter to do it - and of course the above may break if
you've got _sleep to lose the references.

C.

 

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

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