Cast class reference to pointer of another class?
Paul Backus
snarwin at gmail.com
Thu Jun 10 23:47:33 UTC 2021
On Thursday, 10 June 2021 at 21:25:35 UTC, JN wrote:
> I have to disagree. I don't see a good reason for this behavior
> and it's just one more thing to trip people. I think it'd be
> better if such thing was done explicit, something like:
>
> ```d
> Bar b = new Bar();
> Foo* f2 = cast(Foo*)b.ptr;
> ```
Isn't having to write out `cast(Foo*)` already pretty explicit?
More information about the Digitalmars-d-learn
mailing list