|
-
Nov 15th, 2010, 12:25 AM
#1
Thread Starter
Hyperactive Member
Structures and Arraylists
I was curious about the following scenario.
If I am understanding correctly, a structure is a value type, and a class is a reference type. This means from prior discussions I have had that a structure can be directly copied so that the copy is truly independent of the original:
Code:
CopyOfMyStructure = MyStructure
However, a copy of a class is NOT independent and simply vectors to the identical address of the original.
Now, If I am not mistaken, an arraylist is a class object. So if I copy a bunch of structures (value type) into an arraylist (reference type), do the structures that were copied in, get changed to reference type since they are now inside the arraylist?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|