Different Class Implements One Interface

 
    <?phpclass 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() {
    }
}?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.