# Polymorphic copy

*Object.dclone()* makes a deep clone of any mutable object and returns it to the caller.

```ruby
class T(value) {
    method display {
        say value
    }
}

class S(value) < T {
    method display {
        say value
    }
}

var obj1 = T("T")
var obj2 = S("S")
var obj3 = obj2.dclone          # make a deep clone of obj2

obj1.value = "foo"              # change the value of obj1
obj2.value = "bar"              # change the value of obj2

obj1.display                    # prints "foo"
obj2.display                    # prints "bar"
obj3.display                    # prints "S"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/programming_tasks/p/polymorphic_copy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
