Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deep Copy of a collection class
Message
 
To
All
General information
Forum:
Visual Basic
Category:
Other
Title:
Deep Copy of a collection class
Miscellaneous
Thread ID:
00511908
Message ID:
00511908
Views:
51
I have a collection class based on the "Creating Your Own Collection
Class: The House of Bricks" article from the VS6a documentation.

My Answers_bo class wraps two private collections: FAnswers which holds
the answers to a question and FPersistedAnswers which holds the answers
that have already been saved to the database.

I need to copy 1 Answers_bo instance to a new Answers_bo instance.
What I'd like to do is:

*** Start code ***

Class Answers_bo
private FAnswers as Collection
private FPersistedAnswers as Collection

Public sub CopyFrom( oAnswers as Answers_bo )
CloneCollection oAnswers.FAnswers, FAnswers
CloneCollection oAnswers.FPersistedAnswers, FPersistesAnswers
End Sub

Private Sub CloneCollection(colSource As Collection, colDest As
Collection)
Dim oSrc As Antwoord_bo
Dim oDst As Antwoord_bo
ClearCollection colDest
For Each oSrc In colSource
Set oDst = New Antwoord_bo
oDst.CopyFrom oSrc
colDest.Add oDst, oDst.CollectionKey
Next
End Sub

*** End Code ***

However, VB (6) complains that FAnswers and FPersistedAnswers are not
members of oAnswers even though I am in the declaration/definition of
the Answers_bo itself?

Is there a way to do this without exposing the FAnswers and
FPersistedAnswers collections to other classes?

Thanks
Marjan
_________________________________________
Marjan Venema
BJM Software (http://www.bjmsoftware.com)
Editor SDGN Magazine (http://www.sdgn.nl)
Next
Reply
Map
View

Click here to load this message in the networking platform