note 108398 added to language.oop5.typehinting
| From: | benayapaul at gmail dot com | Date: | Mon, 23 Apr 2012 09:45:16 +0000 |
| Subject: | note 108398 added to language.oop5.typehinting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187292@lists.php.net to get a copy of this message | ||
// 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');
----
Server IP: 69.147.83.197
Probable Submitter: 122.181.8.98
----
Manual Page -- http://www.php.net/manual/en/language.oop5.typehinting.php
Edit -- https://master.php.net/note/edit/108398
Del: integrated -- https://master.php.net/note/delete/108398/integrated
Del: useless -- https://master.php.net/note/delete/108398/useless
Del: bad code -- https://master.php.net/note/delete/108398/bad+code
Del: spam -- https://master.php.net/note/delete/108398/spam
Del: non-english -- https://master.php.net/note/delete/108398/non-english
Del: in docs -- https://master.php.net/note/delete/108398/in+docs
Del: other reasons-- https://master.php.net/note/delete/108398
Reject -- https://master.php.net/note/reject/108398
Search -- https://master.php.net/manage/user-notes.php