php 设计模式 --桥接模式
php抽象类和接口的区别
https://www.cnblogs.com/vinter/p/8716685.html
什么时候适合使用 --- 多个角色配合工作:抽象角色对应具体角色;
<?php interface icar{ function Run(); } class daben implements icar{ public function Run() { echo "奔驰汽车" ; } } class aodi implements icar{ public function Run() { echo "奥迪汽车"; } } abstract class road{ public $icar; abstract function Run (); } class gaosu extends road{ function Run (){ $this->icar->Run(); echo ":在告诉路上行驶"; } } class xiaolu extends road { function Run () { $this->icar->Run(); echo ":在小路路上行驶"; } } $gaosuroad = new gaosu(); $gaosuroad->icar= new aodi(); $gaosuroad->run(); $gaosuroad = new xiaolu(); $gaosuroad->icar= new daben(); $gaosuroad->run();
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23