added proxy sample

This commit is contained in:
Ilkka Seppala
2014-08-16 20:28:07 +03:00
parent 5cd611bf19
commit a9971dc38f
6 changed files with 84 additions and 0 deletions
@@ -0,0 +1,19 @@
package com.iluwatar;
public class WizardTowerProxy extends WizardTower {
private static final int NUM_WIZARDS_ALLOWED = 3;
private int numWizards;
@Override
public void enter(Wizard wizard) {
if (numWizards < NUM_WIZARDS_ALLOWED) {
super.enter(wizard);
numWizards++;
} else {
System.out.println(wizard + " is not allowed to enter!");
}
}
}