Mega Code Archive

 
Categories / Php / Class
 

Different class implements one interface

<?php class Person {     public $name;     function __construct( $name ) {         $this->name = name;         print "Person constructed with $name\n";     } } interface Command {     function execute(); } class FtpCommand implements Command {     function setHost( $host ) {         print "FtpCommand::setHost(): $host\n";     }     function setUser( $user ) {         print "FtpCommand::setUser(): $user\n";     }     function execute() {     } } class PersonCommand implements Command {     function setPerson( Person $person ) {         print "PersonCommand::setPerson(): {$person->name}\n";     }          function execute() {     } } ?>