-
-
Notifications
You must be signed in to change notification settings - Fork 12
Implementation Role Feature 8
Max Leuthäuser edited this page Nov 18, 2021
·
5 revisions
Roles can play roles
Consider the example where an employee (role of a person) can be a project leader, which is a role of the employee and now indirectly of the person itself.
Consider the banking example:
val stan = Person("Stan")
val brian = Person("Brian")
val accForStan = new Account(10)
val accForBrian = new Account(0)
val _ = new Bank {
val ca = new CheckingsAccount()
val sa = new SavingsAccount()
roleGroups.checked {
accForStan play ca
accForBrian play sa
}
stan play new Customer()
brian play new Customer()
// ...
}
Both accounts (core objects/players) play the CheckingsAccount
role, which itself plays the Source
/Target
role respectively.
None.