If I do this:
Dim w As MyClass = otherObject
where “otherObject” is another variable containing an instance of MyClass, I can be sure that w is a completely different variable? I mean, whatever changes I do to w, will NOT affect otherObject, right?
Variables are just pointers to instances of objects in memory. When you assign the variable
wto point atotherObjectthey both point at the same object in memory. Making changes to one will affect the other.If you are wanting to make
wa clone ofotherObjectyou can refer to this codeproject aritcle.