ruben murillo

ruben murillo

  • NA
  • 11
  • 473

Address Objects and Fields

Sep 5 2021 8:16 PM

i´m newbie in c sharp. i´m learning on my own. i got the next question. i´m not native english speaker.

let´s suppose there is a class named Numbers

public class
{
    public int x;
    public int y;
    public int z;
}

when an instance of class number is created, its address is stored at stack memory and fields are

stores at heap memory, i suppose address at stack of instance is equal to the address of first

field (int x)  at the heap. if i want to know value of field z, how compiler get that value but doesn´t know

its address.

thanks in advance

Ruben


Answers (1)