Subtyping of an enum

Anton Fediushin fediushin.anton at yandex.com
Mon Apr 15 13:40:44 UTC 2019


On Monday, 15 April 2019 at 12:25:38 UTC, XavierAP wrote:
> On Monday, 15 April 2019 at 10:34:42 UTC, Anton Fediushin wrote:
>> On Monday, 15 April 2019 at 10:06:30 UTC, XavierAP wrote:
>>> [snip]
>>
>> Isn't this how subtyping works for integers and other types? 
>> For example, you have subtyped an integer and added some new 
>> methods to it?
>
> Yes (leaving aside whether stuff is private or nested) but you 
> are using the types' relationship the other way around. You 
> have:
>
> static assert(is(Enum : internal));
>
> But you are defining and calling fun() as if it were the other 
> way around (internal : Enum)

Thank you, I understand now! I think I'd have to stick with UFCS 
method


More information about the Digitalmars-d-learn mailing list