dlang custom keyword for struct/class

FeepingCreature feepingcreature at gmail.com
Sun Sep 17 16:11:53 UTC 2023


On Sunday, 17 September 2023 at 15:55:37 UTC, Vitaliy Fadeev 
wrote:
> Is it possible to write like this in D?
>
> ```d
> struct Message
> {
>    ulong timestamp;
> }
>
> Message LongMessage
> {
>     ubyte[255] s;
> }
> //
> // it mean
> //
> // struct LongMessage
> // {
> //     Message _super;
> //     alias _super this;
> //     ubyte[255] s;
> // }
> //
> // or
> //
> // struct LongMessage
> // {
> //     ulong timestamp;
> //     ubyte[255] s;
> // }
> ```
>
> Is it possible?

No, there's no struct inheritance. But you can just write the 
`alias this` version manually.


More information about the Digitalmars-d-learn mailing list