First off, those aren't pointers, they are references. Pointers are a very different beastie and require
unsafe
code to use.
As does
sizeof
- because you don't need to know under normal circumstances.
However, since these are references, they have a fixed size - exactly the same as that for a
string
. The actual size is fixed, but what it is depends on your system: for 32 bit systems, it is 32 bits, for 64 bits systems it is 64.
However, this is the size of the
reference
not the heap object that is being referred to:
string s1 = "Hello";
string s2 = "However, since these are references, they have a fixed size - exactly the same as that for a <code>string</code>.";
s1 and s2 are the same size - 32 or 64 bits - because the variable is not the object it is referring to.
So...for a 32 bits system, your Node is 28 bytes, for a 64 bit system it's 48 bytes.
But...it may not be, depending on how the framework organised things when it creates the object: it may add padding to extend the integers to 64 bits, or pack them together into a 64 bit word, and it will quite probably add padding at the end to "fill" a natural size on the heap at 32 bytes or 64 bytes.
It's not really relevant, unless you are trying to use a
struct
instead of a
class
- because you really don't have much control over the actual space it takes up! :laugh: