klyn.Object.deepCopy
method

    public native deepCopy() as this

Description

Creates a deep copy of the current object graph.

The static return type is the receiver type, while the allocated object keeps the concrete runtime type of `this`. Object fields and collection elements are copied recursively; immutable scalar values such as strings may be shared safely by the runtime.

Cycles and shared references are preserved during the copy.

Returns

A deep copy of the current object.

Example

    shape as Shape = Circle(10)
    copy = shape.deepCopy()
    assert copy is Shape
    assert copy is Circle