▲ | oefrha 4 days ago | |||||||||||||||||||||||||
The missing something is manually creating the structs, not casting. | ||||||||||||||||||||||||||
▲ | Thorrez 4 days ago | parent | next [-] | |||||||||||||||||||||||||
>And yes you should convert to OrderTypeA or OrderTypeB at the first opportunity How would you convert Order to OrderTypeA? You would need some other source to fill TypeAAttr1 and TypeAAttr2 with. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | debugnik 3 days ago | parent | prev [-] | |||||||||||||||||||||||||
You said struct embedding could be used for discriminated unions, but there's no mechanism to discriminate between union variants here. | ||||||||||||||||||||||||||
|