note 108398 deleted from language.oop5.typehinting by salathe
| From: | salathe@php.net | Date: | Mon, 23 Apr 2012 13:18:19 +0000 |
| Subject: | note 108398 deleted from language.oop5.typehinting by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187303@lists.php.net to get a copy of this message | ||
Note Submitter: benayapaul at gmail dot com
----
// small example about type hinting using abstract class & function
abstract class for_type_int {
public function a() {
echo "abstruct class a function";
}
public function b() {
echo "abstruct class b function";
}
}
class cls extends for_type_int {
function __construct($a) {
$this->a = $a;
}
function ab() {
return $this->a;
}
}
function type_ints($obj,$name) {
return $obj->$name();
}
$o = new cls('checking');
echo type_ints($o,'b');