How to implement multiple interfaces in php, php implementation_PHP tutorial

WBOY
Release: 2016-07-13 09:49:35
Original
720 people have browsed it

How to implement multiple interfaces in php, php implementation

This article describes the implementation method of multiple interfaces in php. Share it with everyone for your reference. The details are as follows:

<&#63;php 
  interface staff_i1 //接口1 
  { 
   function setID($id); 
   function getID(); 
  }   
  interface staff_i2 //接口2 
  { 
   function setName($name); 
   function getName(); 
  }     
  class staff implements staff_i1, staff_i2 //接口的实现 
  { 
   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() 
   { 
    echo "Test"; 
   } 
  } 
&#63;>

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1019436.htmlTechArticleThe implementation method of php multiple interfaces, php implementation This article describes the implementation method of php multiple interfaces. Share it with everyone for your reference. The details are as follows: php interface staff_i1 //Interface 1 {...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template