-
-
Notifications
You must be signed in to change notification settings - Fork 12
Implementation Role Feature 3
Max Leuthäuser edited this page Oct 16, 2015
·
4 revisions
Objects may play different roles simultaneously
Because a role is a type (and implemented as classes in SCROLL) it amounts to the multiple classification of objects.
Consider e.g. the robot example:
val myRobot = Robot("Pete") play ServiceRole() play NavigationRole() play ObservingEnvironmentRole() play DriveableRole()
By simply calling the play
-method multiple times you can attach as many roles as you want.
The return type of the play
-method is a generic Player
instance, typed with your core- (player) object. In this example Robot
, hence Player[Robot]
. If you want to get back the original instance of the core object please use playing
.