dimanche 26 mai 2019

How to associate a Class with more than one behavior with other Class?

I have some objects that need two types of behavior at the same time when are associated with a Game Class. How is the best way to do this? I'm not seeing any of the GoF Patterns here to help but maybe i'm just with my brain overloaded.

interface Actor {}

class Man implements Actor {}

class Woman implements Actor {}

class Game {
    private Map<Actor> actors;
}

How to include Player, Referee or LineJudge behavior to this code.

Example:

Game 1, Actor 1 Woman and Referee, Actor 2 Woman and Player Game 2, Actor 1 Woman and Player, Actor 2 Man and Player Game 3, Actor 1 Man and Player, Actor 2 Man and Referee, Actor 3 Woman and LineJudge

...

Aucun commentaire:

Enregistrer un commentaire