Adapter mode, adapter mode java_php Tutorial

Source: Internet
Author: User

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.