Function Overloading

Basile B. b2.temp at gmx.com
Thu Nov 2 16:06:14 UTC 2023


On Thursday, 2 November 2023 at 11:17:42 UTC, Salih Dincer wrote:
> On Wednesday, 1 November 2023 at 20:04:52 UTC, Basile B. wrote:
>>
>> Yes. D constructors are not named but the current 
>> implementation adds a name that is `__ctor`, so add
>>
>> ```d
>> alias add = __ctor;
>> ```
>>
>> to you struct.
>>
>
> Yeah, it works! Thanks...:)
>
> SDB at 79

I'm no sure how this could be used IRL but keep well in mind that 
**this is not nice code**.

My answer should be more interepreted as "yes that is technically 
possible". ("can do" -> yes VS "should do" -> no).

You also have the `opCall()` option btw.


More information about the Digitalmars-d-learn mailing list