Structs as reference types?

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sat May 29 18:40:40 UTC 2021


On Saturday, 29 May 2021 at 18:34:44 UTC, sighoya wrote:
> What about:
>
> ```D
> ptr struct S
> {
>      int i;
> }
> void main()
> {
>     S s = S(1);
>     writeln("s: ",s.i); //1
> }
> ```

That is literally a final class:
-------
final class S {
int s;
}

void main() {
S s = new S();
writeln("s: ", s.i);
}
-------

Best regards,
Alexandru.


More information about the Digitalmars-d mailing list