Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: ea1122 on November 21, 2025, 12:33:52 am
-
Class A contains activity A() and a subclass B containing activity B().
But when A() calls B() a code error is generated:
public void A(a, b) {
// behavior is a Activity
/*Warning: B - Invoking behaviors from other classes - Not Supported!!*/
}
So how does an activity invoke a behavior defined in a subclass of its own class?
-
Class A contains activity A() and a subclass B containing activity B().
But when A() calls B() a code error is generated:
public void A(a, b) {
// behavior is a Activity
/*Warning: B - Invoking behaviors from other classes - Not Supported!!*/
}
So how does an activity invoke a behavior defined in a subclass of its own class?
Don't you think it's a bit weird that a class knows about it's subclasses? I think that violates the Open/Closed principle
But regardless of that, apparently, as indicated by the warning messages, invoking behaviors defined in other classes (whether they are subclases or not) is not supported.
Geert
-
Thank you for your reply!
If all activities must be defined in the same class as any invoking activity, should all activities be in the same class to permit them to invoke each other?
Separating classes permits grouping of related components, the main value of classes.
I much appreciate your help!
-
OK, I see my error.