note 96556 added to language.oop5.constants
| From: | narwhal dot jury at gmail dot com | Date: | Thu, 04 Mar 2010 21:04:50 +0000 |
| Subject: | note 96556 added to language.oop5.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166686@lists.php.net to get a copy of this message | ||
It's worth noting that with v5.3, the problem mentioned a few times in these notes of
referencing a childs const within a parent is solved!
<?php
class MyClass {
const MY_CONST = "yonder";
public function __construct() {
$c = get_class( $this );
echo $c::MY_CONST;
}
}
class ChildClass extends MyClass {
const MY_CONST = "bar";
}
$x = new ChildClass(); // prints 'bar'
$y = new MyClass(); // prints 'yonder'
?>
RJ
----
Server IP: 69.147.83.197
Probable Submitter: 64.111.153.248
----
Manual Page -- http://www.php.net/manual/en/language.oop5.constants.php
Edit -- https://master.php.net/note/edit/96556
Del: integrated -- https://master.php.net/note/delete/96556/integrated
Del: useless -- https://master.php.net/note/delete/96556/useless
Del: bad code -- https://master.php.net/note/delete/96556/bad+code
Del: spam -- https://master.php.net/note/delete/96556/spam
Del: non-english -- https://master.php.net/note/delete/96556/non-english
Del: in docs -- https://master.php.net/note/delete/96556/in+docs
Del: other reasons-- https://master.php.net/note/delete/96556
Reject -- https://master.php.net/note/reject/96556
Search -- https://master.php.net/manage/user-notes.php