Copies the properties of an object to a destination object.
procedure AssignTo(Dest: TPersistent); virtual;
virtual __fastcall AssignTo(TPersistent * Dest);
Override the AssignTo method to extend the functionality of the Assign method of destination objects so that they handle newly created object classes. When defining a new object class, override the Assign method for every existing object class that should be able to copy its properties to the new class. Override the AssignTo method for every existing class to which the new class can copy.
The Assign method of TPersistent calls AssignTo if the descendant object does not succeed in copying the properties of a source object. The AssignTo method defined by TPersistent raises an EConvertError exception.
For example, given the following code in which A and B are instance variables:
A->Assign(B); // C++
B->AssignTo(A); // C++
If B knows how to copy to A, the assignment succeeds. Otherwise, TPersistent raises an exception.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!