Mega Code Archive
Using Type Hinting with Interfaces
value = NULL;
}
}
class Integer extends Number implements printable {
private $value;
function __construct($value) {
$this->value = $value;
}
public function getValue() {
return (int)$this->value;
}
public function printme() {
echo (int)$this->value;
}
}
function printNumber(printable $myObject) {
$myObject->printme();
}
$inst = new Integer(10);
printNumber($inst);
?>