D
deltaquattro
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
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