location_object.Clone Method

Method that returns a copy of the location_object.
...location_object. Clone

Prerequisites

None

Parameters

None

Remarks

For objects, if a program contains a simple assignment statement:

object_1 = object_2

the result is that object_1 points to the same data as object_2. Any subsequent change of a property in either object_1 or object_2 affects the data associated with both objects. To make an independent copy of an object, the Clone method is the standard means for performing this operation:

object_1 = object_2.Clone

Examples

Dim loc1 As New Location    'Create new location set to default values
Dim loc2 As Location 'Create new location with no data allocated
loc1.X = 10.2 ' Set X position in loc1.
loc2 = loc1.Clone ' Makes a copy of loc1 data
loc2.Y = -27.1 ' Doesn't affect loc1 data

See Also

Location Class