I would like to know what happens when we create an object "a", then make a reference "b" to it and then we create a new object with "a", what happens to 56? How I understand it that "a" loses its reference to 56 creating a new reference to 20. Making "b" the only holder of reference to 56.
class SingleDigit
{
public int Digit { get; set; }
public SingleDigit(int b)
{
Digit = b;
}
}
SingleDigit a = new SingleDigit(56); // creat new object with int 56
SingleDigit b = a; // make a reference to a
b.Digit -= 20; // both a and b's digit is subtracted
a = new SingleDigit(20); // What happens here ? Does a lose its reference to 56 ?