接口技術(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) ;
##
不求驚動(dòng)動(dòng)地,但求無(wú)愧于人生!