Can we just have struct inheritence already?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Jun 9 16:04:46 UTC 2019


On Sunday, 9 June 2019 at 13:59:25 UTC, Jonathan M Davis wrote:
> I've never even seen code use such a pattern before, and 
> honestly, it seems really weird to me to even write code that 
> acts like one struct is derived from another, because without 
> polymorphism, I wouldn't really have thought that that would 
> make any sense.

It is very common. If you want to model events as value types for 
instance.

It is common even in C, implemented as unions with 
reinterpretation casts. Most large frameworks do this in one way 
or another. Random example: X-Windows.






More information about the Digitalmars-d mailing list