added visitor pattern sample

This commit is contained in:
Ilkka Seppala
2014-08-23 18:45:55 +03:00
parent 23e2faeca2
commit 19554d2329
11 changed files with 188 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package com.iluwatar;
public class App
{
public static void main( String[] args )
{
Commander commander = new Commander(
new Sergeant(new Soldier(), new Soldier(), new Soldier()),
new Sergeant(new Soldier(), new Soldier(), new Soldier()));
commander.accept(new SoldierVisitor());
commander.accept(new SergeantVisitor());
commander.accept(new CommanderVisitor());
}
}