<?php/* Bridging mode: Separates the abstract and the implementation parts so that they can be independently changed. * * in software systems, some types because of their own logic, it has two or more dimensions of the change, bridging mode is to deal with this multidimensional changes *//* example: different cars in different streets driving. Car variable, street variable * * */abstract class Road{abstract Public function run (); Class Quickroad extends Road{public $car;p ublic function __construct ($car) {$this->car = $car;} Public Function Run () {$this->car->run (); Echo ' Drive on the freeway ';}} Class Street extends Road{public $car;p ublic function __construct ($car) {$this->car = $car;} Public Function Run () {$this->car->run (); Echo ' City street Drive ';}} Abstract class Car{abstract Public function Run ();} Class Jeep extends Car{public function run () {echo ' Jeep in ';}} Class Bus extends Car{public function run () {echo ' Bus in ';}} $car = new bus (); $road = new Quickroad ($car); $road->run (); echo "<br/>"; $car = new Jeep (); $road = New Street ($car) ; $road->run ();? >
UML Class Diagram
Bridging mode for PHP implementation of design Patterns