Memory Allocation for Variable Declared in Class

前端 未结 4 739
灰色年华
灰色年华 2021-02-06 03:30

As Value type variable allocates memory in Stack where as Reference Type allocates it in Heap.

So how the memory allocated when a value type variable(eg int i =4;) is d

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 04:21

    So how the memory allocated when a value type variable(eg int i =4;) is declared in the reference type (eg. in a class).

    If the object lies on heap, it means all it's member variable(s) lies there.

提交回复
热议问题