Podsumowanie wzorców projektowych GoF
Podsumowanie wzorców projektowych GoF
Podsumowanie wzorców projektowych GoF
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
public class TeaBag {boolean teaBagIsSteeped;public TeaBag() {teaBagIsSteeped = false;}}public void steepTeaInCup() {teaBagIsSteeped = true;System.out.println("tea bag is steeping in cup");}LooseLeafTeapackage pk.dydakt.to.dp.s.gof.adapter;public class LooseLeafTea {boolean teaIsSteeped;public LooseLeafTea() {teaIsSteeped = false;}}public void steepTea() {teaIsSteeped = true;System.out.println("tea is steeping");}TeaBallpackage pk.dydakt.to.dp.s.gof.adapter;public class TeaBall extends TeaBag {LooseLeafTea looseLeafTea;public TeaBall(LooseLeafTea looseLeafTeaIn) {looseLeafTea = looseLeafTeaIn;teaBagIsSteeped = looseLeafTea.teaIsSteeped;}}public void steepTeaInCup() {looseLeafTea.steepTea();teaBagIsSteeped = true;}Wyjcie na konsoli:Steeping tea bagtea bag is steeping in cupSteeping loose leaf teatea is steeping33