I understand the theoretical concept that assigning one reference type variable to another, only the reference is copied, not the object. assigning one value type variable t
On my system, those two code blocks produce the following output:
Original Employee Values:
joe = Joe bob = Bob Values After Reference Assignment: joe = Joe bob = Joe Values After Changing One Instance: joe = Bobbi Jo bob = Bobbi Jo
...and...
Original Height Values: joe = 71 bob = 59 Values After Value Assignment: joe = 71 bob = 71 Values After Changing One Instance: joe = 65 bob = 71
The difference seems self-evident. In the first sample, changing one of the values affects both references, because they are both referencing the same underlying object. In the second sample, changing one of the objects affects only that object, because when value types are copied, each object receives it own private copy. When you say bob = joe; in the second sample, you;re not assigning a reference (the comment is misleading). What you're doing is creating a new instance of the Height struct, copying all the values from joe and storing the new object as bob.