clone method of Object
Qian Xu
quian.xu at stud.tu-ilmenau.de
Wed Apr 15 08:40:22 PDT 2009
grauzone wrote:
>
> class A {
> B b;
> }
>
> class B {
> A a;
> }
>
> auto a = new A();
> auto b = new B();
> a.b = b;
> b.a = a;
>
> Your recursive approach wouldn't quite work with that. Before cloning an
> object, you'll first have to check if the object was already cloned. If
> this is the case, use the previously created clone instead of making a
> new clone.
You are right. This case must be considered separately.
More information about the Digitalmars-d-learn
mailing list