예제 #1
0
<?php

include_once '../../class/pattern/abstractFactory.php';
$barrack = new Barrack();
//建立軍營
$terranUnit = $barrack->outputTerranUnit();
//產生人類士兵
$zergUnit = $barrack->outputZergUnit();
//產生異形士兵
$terranUnit->playSlogan();
$zergUnit->shout();
$commandCenter = new CommandCenter();
//建立指揮中心
$terranUnit = $commandCenter->outputTerranUnit();
//產生人類工兵
$zergUnit = $commandCenter->outputZergUnit();
//產生異形工兵
$terranUnit->playSlogan();
$zergUnit->shout();
$airport = new Airport();
//建立機場
$terranUnit = $airport->outputTerranUnit();
//產生人類飛機
$zergUnit = $airport->outputZergUnit();
//產生異形飛機
$terranUnit->playSlogan();
$zergUnit->shout();
예제 #2
0
<?php

include_once '../../class/pattern/factory.php';
$barrack = new Barrack();
// 建立軍營
$solider = $barrack->outputUnit();
// 產生單位
$solider->playSlogan();
$commandCenter = new CommandCenter();
// 建立指揮中心
$worker = $commandCenter->outputUnit();
// 產生單位
$worker->playSlogan();
$airport = new Airport();
// 建立機場
$aircraft = $airport->outputUnit();
// 產生單位
$aircraft->playSlogan();
예제 #3
0
<?php

include_once "./factory.php";
$b = new Barrack();
$bt = $b->outputTeranUnit();
$bz = $b->outputZergUnit();
$bt->playSlogan();
$bz->shout();
$c = new CommandCenter();
$ct = $c->outputTeranUnit();
$cz = $c->outputZergUnit();
$ct->playSlogan();
$cz->shout();
$a = new Airport();
$at = $a->outputTeranUnit();
$az = $a->outputZergUnit();
$at->playSlogan();
$az->shout();