I have a class, call it myClass and it consists of a number of properties and methods. I also have a collection that I am iterating through that contains a number of myClass objects.
private best as myClass 'this is used to hold the best value found
private myCollection as collection
private sub main()
dim temp as myClass
dim i as long
'There are a number of steps here that are not important but they lead to the initialization of myCollection with myClass objects
for i = 1 to 100
for each temp in myCollection
if temp.value < best.value then
set best = temp
end if
next temp
'Another sub here goes through and re-evaluates the collection
next i
'print out the properties of best here
end sub
The above example is simplistic but gets the point across. I know what is happening, each time the statement:
set best = temp
is executed, the best is pointed to the object that temp is pointed to. What I need to happen is that a new object is created (that is identical to the object pointed to by temp but in a different location in memory) and the memory location is stored in best.
I hope that I made myself clear. Any help would be greatly appreciated......
P.S. I am currently solving the problem by basiclly doing this:
set best = new myClass
best.value = temp.value 'and so on setting all the properties....
Troy Williams B.Eng.
fenris@hotmail.com
private best as myClass 'this is used to hold the best value found
private myCollection as collection
private sub main()
dim temp as myClass
dim i as long
'There are a number of steps here that are not important but they lead to the initialization of myCollection with myClass objects
for i = 1 to 100
for each temp in myCollection
if temp.value < best.value then
set best = temp
end if
next temp
'Another sub here goes through and re-evaluates the collection
next i
'print out the properties of best here
end sub
The above example is simplistic but gets the point across. I know what is happening, each time the statement:
set best = temp
is executed, the best is pointed to the object that temp is pointed to. What I need to happen is that a new object is created (that is identical to the object pointed to by temp but in a different location in memory) and the memory location is stored in best.
I hope that I made myself clear. Any help would be greatly appreciated......
P.S. I am currently solving the problem by basiclly doing this:
set best = new myClass
best.value = temp.value 'and so on setting all the properties....
Troy Williams B.Eng.
fenris@hotmail.com