Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cloning an object which contains a collection
Hi,
another OOP question: I'm implementing a Class which contains a Collection property. Until now, all properties in my objects would be either scalars or arrays of a basic type (Long, Double, etc.). But now, one of them is a Collection. The Collection is used to store String variables: I'm not trying to do something as perversed as deep cloning of an object which contains another object which contains other objects, etc, etc, :) How can I implement the Clone method, to correctly clone also the Collection property? I guess I'll have to do something like: ' Class1 Public Function Clone() As Class1 Dim Str As String Set Clone = New Class1 'code to copy "regular" properties For Each Str in Me.ErrString 'ErrString is the Collection inside Class1 Clone.ErrString.Add Str Next End Sub Is this the best way? Thnx, Best Regards deltaquattro |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Collection Object | Excel Programming | |||
Collection Object | Excel Programming | |||
How to track object index in object collection | Excel Programming | |||
Adding Name object to a collection does not add an object | Excel Programming |