Is it possible to extend an Enum type in Ada? if I have for example:
type ABC_Type is (A, B, C);
Now I want new type ABCDE_Type that will include everything that ABC_Type has and Also (D, E). Is there a way to do that?
No, you cannot extend an Enum type in Ada, you can only create derivations/subtypes that cover a subset of the original one.
You have to do it the other way round:
type ABCDE_Type is (A, B, C, D, E);
type ABC_Type is new ABCDE_Type range A .. C;
-- or
subtype ABC_Type is ABCDE_Type range A .. C;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With