- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Supertype of enumeration
Supertype of enumeration
Supertype of enumeration
Hello,
Is it possible to declare a new enumeration as being a supertype of an existing enumeration ? So that when the base enumeration is modified, the second takes it into account.
I can't find a syntax that would work, nor any help on the subject.
Thanks,
JB.
For example:
type BaseEnumeration=enumeration(base1,base2,base3);
type CompletedEnumeration=enumeration(base1,base2,base3,comp1,comp2); //as =BaseEnumeration added of comp1,comp2
Re: Supertype of enumeration
The only way I could think of was the following, but it won't work because you may only inherit from one class of type restriction.
Code:
class A
type E1 = enumeration(a,b,c);
type E2 = enumeration(d,e,f);
type F
extends E1;
extends E2;
end F;
F f;
end A;
The following does flatten, but won't produce correct code:
Code:
class A
class E1 = enumeration(a,b,c);
class E2 = enumeration(d,e,f);
class F
extends E1;
extends E2;
end F;
F f;
end A;
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Supertype of enumeration