How to implement PHP single interface
This paper describes the implementation of PHP single interface. Share to everyone for your reference. The implementation method is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21st 22 23 24 25 26 27 28 29 30 31 32 33 34 |
Interface Staff_i { function SetID ($id); function GetID (); function SetName ($name); function GetName (); } Class staff implements Staff_i//This class is used to implement the Staff_i interface { Private $id; Private $name; function SetID ($id) { $this->id = $id; } function GetID () { return $this->id; } function SetName ($name) { $this->name = $name; } function GetName () { return $this->name; } function Otherfunc ()//This is a method that does not exist in an interface { echo "Test"; } } ?> |
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1020289.html www.bkjia.com true http://www.bkjia.com/PHPjc/1020289.html techarticle the implementation method of PHP single interface This paper introduces the implementation of PHP single interface. Share to everyone for your reference. The specific implementation method is as follows:? 1 2 3 4 5 6 7 8 9 ...