mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 22:58:36 +00:00
added visitor pattern sample
This commit is contained in:
@@ -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());
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user