abstract with copy inheritance [message #555937] |
Mon, 30 August 2010 06:08  |
Eclipse User |
|
|
|
Suppose we have a simple base class B with a method bar.
Let us look at the following team T0:
public abstract team class T0 {
protected abstract class R {
protected abstract void foo();
}
protected abstract class NR extends R playedBy B {
foo <- before bar;
}
}
Due to the abstract method foo, both roles and therefore the team have to be abstract.
Now let us have a look at a subclassing team T1:
public team class T1 extends T0 {
protected class R {
protected void foo(){...};
}
protected class NR {};
}
Here of course, we have to add the missing implementation of foo to make the role R non-abstract. However, role NR must be "overridden" as well to get rid of the abstract property.
I understand, that the mechanism has to handle the "abstract"-issue explicitly. But the resulting implementation with an empty role class seems to be a little odd. Is there a better way to deal with implicit inheritance like in this situation?
[Updated on: Mon, 30 August 2010 09:44] by Moderator
|
|
|
|
|
|
Re: abstract with copy inheritance [message #574559 is a reply to message #574532] |
Mon, 30 August 2010 10:21  |
Eclipse User |
|
|
|
Version 1 (as it is) is definitely what you would expect and I admit I don't have any better ideas :(
The point is, that a property like abstract (the same with final) is set for both dimension of inheritance (explicit and implict) equally without chance of differentiation.
There are some minor restrictions, e.g. I could not make T0.NR (non-abstract) final, if I would like to force overriding of R and prohibit overriding of NR. But that is a reasonable trade-off when combining "abstract" with virtual classes and keeping it simple.
|
|
|
Powered by
FUDForum. Page generated in 0.04105 seconds