Understanding the meaning of interfaces in php Interfaces

Source: Internet
Author: User

Everyone may understand this. I guess the meaning of this interface, which is used to call the interface content in the implementation class in the method called later, let's take a look at it later.
Pay. php Copy codeThe Code is as follows: interface Ipay
{
Function withmoney ();

// Function withinternet ();
}
Class Dmeng implements Ipay
{

Function withmoney ()
{
Echo "shopping in RMB ";
}
Function withinternet ()
{
Return "pay with online banking ";
}
}

Usei. phpCopy codeThe Code is as follows: include_once 'pay. php ';
Class main
{
Function run ($ vc)
{
$ This-> vc = $ vc;
$ This-> vc-> withinternet ();
Echo "yunxing ";
}

}
$ Com = new main ();
$ Com-> run (new Dmeng );

In the above way, We comment out a method in the interface and find that it is useless when we call it again.

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.