In c#, as objects are reference types, why is below output d100? Should it not be d500 as we changed it in ChangeReferenceObj and both o and a are pointing to same object?
using System;
public class Program {
static void ChangeReferenceObj(object a)
{
Console.WriteLine("e"+a);
a=500;
Console.WriteLine("f"+a);
}
public static void Main(string[] args)
{
object o=100;
Console.WriteLine("b"+o);
ChangeReferenceObj(o);
Console.WriteLine("d"+o);
}
}
Output:
b100
e100
f500
d100