Class member always has the same address

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 19 13:29:02 PDT 2016


On 19.03.2016 21:24, szymski wrote:
> In my opinion &a.b.variable should give different addresses for each
> instance of A, because it's not static. What am I doing wrong? Thanks in
> advance.

The As are different, but they all reference the same B. Initialize b in 
a constructor instead.


More information about the Digitalmars-d-learn mailing list