need `this` for `this` of type `ref @safe Test(string reg_arg)

rempas rempas at tutanota.com
Sun Jun 18 19:05:19 UTC 2023


On Sunday, 18 June 2023 at 18:17:16 UTC, Paul Backus wrote:
>
> `__ctor` doesn't create a new object, it initializes an 
> existing object. You need to create the object first, then call 
> `__ctor` on it:
>
> ```d
> void main() {
>   Test test;
>   test.__ctor!("non_def")("Hello");
> }
> ```

Thank you! Do you know any other way to do it without using 
"__ctor".

I'm not sure if it was clear that it's not that I specifically 
want to do it with "__ctor" so I'm making it clear just to be 
sure.


More information about the Digitalmars-d-learn mailing list