php interface implements multibus

<?php
/*
 * Created on 2009-10-28
 * 分子如梦o(╯□╰)o
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

 interface pusb{

 

    function verson();
    function type();

 }


 class mouse implements pusb{

     function verson(){

        echo "USB 2.0版本;";
    }

     function type(){

        echo "鼠标<br>";

    }

 }


 class video implements pusb{

    function verson()
    {
     echo "USB 1.0版本;";

    }

    function type(){

        echo "视频";

    }

 }


class myPC{

    function output($that){
        $that->verson();
        $that->type();

    }

}

$p = new myPc();
$mouse = new mouse();
$video = new video();


$p->output($mouse);
$p->output($video);

if($p instanceof myPc){
 echo "<BR>YES.myPc";
}

?>

你可能感兴趣的:(PHP,function,video,Class,interface,templates)