<?php
class Light
{
function turnOn ()
{
echo "da kai shan guang deng ";
}
function turnOff ()
{
echo "guan bi shan guang deng ";
}
}
class Camera
{
function active ()
{
echo "da kai zhao xiang ji";
}
function deactive ()
{
echo "guan bi zhao xiang ji";
}
}
class Facade
{
protected $light;
protected $camera;
function __construct ()
{
$this->light = new Light();
$this->camera = new Camera();
}
function start ()
{
$this->light->turnOn();
$this->camera->active();
}
function stop ()
{
$this->light->turnOn();
$this->camera->deactive();
}
}
$f = new Facade();
$f->start();
$f->stop();
//$light = new Light();
//$camera = new Camera();
php高级实战-门面模式
最新推荐文章于 2024-09-01 02:07:48 发布