Can static variables in methods be local for each object?

Mark Lagodych lgd.mrk at gmail.com
Tue Jul 20 09:26:05 UTC 2021


On Tuesday, 20 July 2021 at 09:24:07 UTC, Mark Lagodych wrote:
> ```d
> void main()
> {
>     X x1 = new X;
>     X x2 = new X;
>
>     x1.x(0).writeln;
>     x2.x(0).writeln;
>
>     x1.x(17).writeln;
>     x2.x(0).writeln;
> }
> ```

Ow, sorry, I forgot to say. It prints:
```
1234
1234
17
17
```



More information about the Digitalmars-d-learn mailing list