This is a basic question which is confusing me…
Here is the sample code…
static void Main(string args)
c obj = new c();
obj.a = 11;
public int a = 10;
Now my question is we know integer is a value type and classes/objects are reference types…
Then obj.a now a is a value type of a reference type ?
since without boxing we can directly assign a value to obj.a = 11 which suggests that it is a value type… but isn’t “a” under the object obj which is reference type ?
How it is stored internally ?
Where is “a” stored ?
where is “obj” stored?
as far as I know a should be stored in a stack as it is value type and obj in heap as it is reference type… but how they are associated ? can heap hold stack ? how does it work ?
Thanks for looking…