According to the code below, could you please tell me how (and if it possible to) refer to the array defined inside the class ComputationUnit
from the class Service
?
class ComputationUnit {
contains Method[1..*] methods
}
class Method {
String name
String signature
Object sourceCode
contains Parameter[1..*] parameters
}
class Servic e {
contains Comment comment
contains Parameter[1..*] parameters
contains Contract[0..*] contracts
refers Method[] methods //How can I refer to the array defined inside the ComputationUnit class?
}
You can't. It doesn't make sense. There isn't just one array defined inside the ComputationUnit
class, there's an array defined inside each instance of ComputationUnit
. Which instance do you want?
Instead, you should write:
refers ComputationUnit unit
and then access the array as needed from the reference to the unit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.