Hi everyone, am I right in thinking that in the following, thisItem is actually a link (node?) to an instance of that item, instead of the actual instance itself?
' Lets say this has 20 objects, 0 - 19
Global allItems:SomeItem[]
Class SomeItem
' For this example lets say its "bob" followed by the number, so bob0, bob1, bob2, bob3... bob19
Field name:String
Field thisItem:SomeItem
Method setThisItem:Void(newItem:SomeItem)
thisItem = newItem
End Method
End Class So... if I were to run
allItems[5].setThisItem(allItems[6]) and then run
allItems[6].name = "Woop" running
print allItems[5].thisItem.name would give me "Woop"?
So allItems[5].thisItem and allItems[6] are actually still the same object?
Edit, I ask because I am not somewhere where I can run Monkey ;)
|