Method DataObject():copy() Foundation

Creates a dependent shallow copy of this instance

Syntax
:copy() -> oDataObject
Return

This method returns the new DataObject instance.

Description

The method :copy() creates a dependent copy of a data object. "Dependent" in this case means that all instances created using the :copy() method share an identical member and method definition. The values contained in the member variables may be different, however. The addition of new members or methods, and the re-definition of existing methods always applies to the originating object as well as to all of its copies. The originating object is often referred to as the object prototypein this context.

The object instances created using :copy() are so-called shallow copies. Therefore, member variables referencing values such as arrays and objects are shared between all the instances.

Creating an instance with member and method definitions using :copy() is multiple times faster than adding the members and methods manually to a data object created with new().

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.