Reading and Writing Streams MacApp provides stream classes that are useful for transferring data between a variety of destinations, including files, memory, and resources. The TObject class provides methods for reading and writing stream data. Any subclass of TObject can override the WriteTo method to write its data to a stream, and the ReadFrom method to read its data from a stream. MacApp's document classes use streams to write their data to disk. You can create a new object by copying an existing object with the Clone method, which is implemented in TObject .
Cloning produces an object whose fields have the same values as the original object.
It can be an efficient way of duplicating an object without having to copy its values field by field. Classes that allocate memory or do any special handling need to override the Clone method. It then clones any owned objects, sets up any special relationships, and does any other task that can't be handled by simply copying the original object. Complications of Cloning Cloning can become complicated when the cloned object refers to another object. The answer can vary, depending on how the object reference is used.