Understanding the meaning of interfaces in php Interfaces

Source: Internet
Author: User
This article provides a detailed analysis of the meaning of interfaces in php interfaces. For more information, see

This article provides a detailed analysis of the meaning of interfaces in php interfaces. For more information, see

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

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

The 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 );


As shown above, we comment out a method in the interface for the VM, Hong Kong server, and server space, and find that it is useless when it is called 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.