Thanks all. Yes it seems my understanding and "D" vocabulary are still a bit confused.

So I'm taking a D course online and was trying to verify what I was learning. The course example printed out the size and alignment of types...something close to this:
```d
import std.stdio;
import std.traits;

class MyClass {char c;}

void main() {
    writeln(" Size  Alignment  Type\n",
            "=========================");

        size_t size = __traits(classInstanceSize, MyClass);
        size_t alignment = classInstanceAlignment!MyClass;

    writefln("%4s%8s      %s",size, alignment, MyClass.stringof);

        // my test code added
        MyClass MyClassO1;
        MyClass MyClassO2;
        writeln("\n",&MyClassO1,"\t",&MyClassO2);
}
```
...on my laptop it prints...
```
 Size  Alignment  Type
=========================
   9       4      MyClass

4FFB20  4FFB24
```

If the size of MyClass is 9 bytes why do MyClassO1 & O2 addresses only differ by 4 bytes?

Because those addresses(4FFB20 4FFB24) are the addresses of the class **variables**, not the addresses of the **objects** themselves?

So, I guess my question is actually how do I print out the addresses of the MyClassO1 & O2 objects themselves?
```

Reply via email to