亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP class interface technology (interface)
A-王青召
A-王青召 2018-11-14 15:49:57
0
0
1277
接口技術(shù)

What is an interface?

Look at the "development history" of interfaces:

Class--> Abstract class--> A certain "structural form" that is more abstract than abstract class: interface;

Interface: Analogy with abstraction:

There are only abstract methods and constants in the interface;

An abstract class can have abstract methods and other members;

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?Public $p2 = 2;

static $p3=3;

. . . ; . . . }

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????interface C1 {

const p1 = 1;

Abstract F3 (); The abstract class of the method is the same form!

However, the reason why it is called an interface is because it stipulates that interfaces can implement multiple inheritance;

##Use of interface:

The purpose of designing an interface is to allow "classes" to inherit it and use its constants and (abstract) methods.

When a class inherits one (or more) interfaces, it is not called inheritance, but called "implements",

That is: a class implements a certain interface(s) ;


## Form:

class class name [extends parent class name] implementations interface name 1, interface name 2,... {

?????????????????????… Definition of class members;

??????????????????????????????????????????

Inheritance of interface:

Interfaces can also inherit from each other - this is called inheritance;

Moreover, they can also perform multiple inheritance!

Indicative code:

Interface I1{.... }

Interface I2{.... }

Interface I3 extends I1, I2{

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const PI = 3.14; Form: Same as the class, use the interface name and the "::" operator to "get";

echo I3::PI; //Output 3.14

##

A-王青召
A-王青召

不求驚動(dòng)動(dòng)地,但求無(wú)愧于人生!

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template