Operations and inheritance Ecore [message #1266402] |
Fri, 07 March 2014 11:57 |
Peter Johnsen Messages: 60 Registered: January 2012 |
Member |
|
|
Hi,
I have a question regarding operations in EMF.
- Let's say I create an operation o( p : EInt) in X, and an operation o( p : EDate ) in Y, where Y is a subclass to X. Why is this legal (validates)?
- Let's say I create an operation o(): EInt in X, and an operation o() in Y, where Y is a subclass to X. Same question.
And how is overloading and overriding in EMF?
Any ideas?
[Updated on: Fri, 07 March 2014 11:57] Report message to a moderator
|
|
|
Re: Operations and inheritance Ecore [message #1266470 is a reply to message #1266402] |
Fri, 07 March 2014 13:57 |
|
Hi, Peter,
Ecore's rules for inheritance and signature overloading are consistent
with Java.
In any case, you can always just try it to see what is generated: it
takes about 2 minutes in the Ecore and Genmodel editors! :-)
cW
On 2014-03-07 11:57:19 +0000, Peter Johnsen said:
> Hi,
>
> I have a question regarding operations in EMF.
>
> - Let's say I create an operation o( p : EInt) in X, and an operation
> o( p : EDate ) in Y, where Y is a subclass til X. Why is this legal
> (validates)?
These operation signatures are distinct in Java, so this is correct in Ecore.
>
> - Let's say I create an operation o(): EInt in X, and an operation o()
> in Y, where Y is a subclass til X. Same question.
If o() in Y has no return type (void), then this is not permitted
because in Java, void is not a subtype of int.
>
> And how is overloading and overriding in EMF?
>
> Any ideas? :)
|
|
|
Powered by
FUDForum. Page generated in 0.03299 seconds