Is it possible to write some class members in another module ?

Vinod K Chandran kcvinu82 at gmail.com
Wed May 20 17:29:47 UTC 2020


On Wednesday, 20 May 2020 at 15:01:36 UTC, welkam wrote:
> On Wednesday, 20 May 2020 at 09:45:48 UTC, Vinod K Chandran 
> wrote:
>> // Now, we need to use like this
>> auto form= new Window();
>> form.event.click = bla_bla;
>>
>> // I really want to use like this
>> auto form= new Window();
>> form.click = bla_bla;
>> ```
>
> Then you want alias this.
>
> class Window : Control{
>    Events event;
>    alias event this
>    .....
> }
>
> and now when you write
> form.click = bla_bla;
> Compiler first checks if form.click compiles and if it doesnt 
> it then it tries form.event.click

Wow !!!
What a perfect solution ! That is what i wanted. Thanks a lot 
friend. :)
The more i practice D, the more i am loving it. I am very sad 
that i delayed to start learning D only because of semicolons and 
curly braces. But now i recognizes that how beautiful this 
language is.


More information about the Digitalmars-d-learn mailing list