-
-
Notifications
You must be signed in to change notification settings - Fork 12
Implementation Role Feature 5
Max Leuthäuser edited this page Nov 18, 2021
·
6 revisions
Objects may acquire and abandon roles dynamically
This allows for dynamic object classification.
Simply use the play
- and drop
-method to acquire and abandon roles.
val someCore = new CoreA()
val someRole = new RoleA()
someCore play someRole
someCore drop someRole
(E.g., CompartmentRoleFeaturesTest.scala)
The internal state of the core- and the role-instance are not lost of course after dropping roles. They are available as long as you keep a reference to them somewhere (and the garbage collection does not kick in).