Adapter mode, adapter mode Java
Adapter mode
Php//Adapter Mode-Performs a third-party method through the adapter//defines the target interfaceInterfacetarget{ Public functionsimpleMethod1 (); Public functionsimpleMethod2 ();}classadatee{ Public functionsimpleMethod1 () {Echo' Adatee simpleMethod1
'; }}//Class Adapter ModeclassAdapterImplementstarget{Private $adatee; Public function__construct (adatee$adatee){ $this->adatee =$adatee; } Public functionsimpleMethod1 () {Echo $this->adatee->simpleMethod1 (); } Public functionsimpleMethod2 () {Echo $this->adatee->simpleMethod12 (); }}//Client Interfaceclassclient{ Public Static functionMain () {$adapter=NewAdapter (Newadatee ()); $adapter-simpleMethod1 (); }}client:: Main ();
http://www.bkjia.com/PHPjc/983245.html www.bkjia.com true http://www.bkjia.com/PHPjc/983245.html techarticle Adapter mode, adapter mode Java adapter mode? PHP//Adapter Mode-Execute third-party method via adapter//define Target Interface interface target{public function Simplem ...