Skip to content

Latest commit

 

History

History
31 lines (29 loc) · 582 Bytes

visitor.md

File metadata and controls

31 lines (29 loc) · 582 Bytes

Visitor

Actions are visitors. Characters accept an Action, allowing new operations such as attack, defense, magic, and run without changing the character hierarchy.

classDiagram
direction LR
class Character {
  <<abstract>>
  +accept(action)
}
class Warrior
class BlackMage
class Thief
class Action {
  <<interface>>
  +visit(character)
}
class Attack
class Defense
class Magic
class Run
Character <|-- Warrior
Character <|-- BlackMage
Character <|-- Thief
Action <|.. Attack
Action <|.. Defense
Action <|.. Magic
Action <|.. Run
Character --> Action : accepts
Loading