note 117506 added to language.oop5.paamayim-nekudotayim
| From: | mohamed dot qabbani at gmail dot com | Date: | Sat, 20 Jun 2015 09:26:32 +0000 |
| Subject: | note 117506 added to language.oop5.paamayim-nekudotayim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202910@lists.php.net to get a copy of this message | ||
How can i access property 'var' in class 'OtherClass' from inside class like the
method myFunc (parent::myFunc();)
<?php
class MyClass {
public $var = 'A';
protected function myFunc() {
echo "MyClass::myFunc()\n";
}
}
class OtherClass extends MyClass {
public $var = 'B';
// Override parent's definition
public function myFunc() {
// But still call the parent function
parent::myFunc();
echo "OtherClass::myFunc()\n";
}
}
$class = new OtherClass();
$class->myFunc();
?>
----
Server IP: 72.52.91.14
Probable Submitter: 105.90.145.110
----
Manual Page -- http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php
Edit -- https://master.php.net/note/edit/117506
Del: integrated -- https://master.php.net/note/delete/117506/integrated
Del: useless -- https://master.php.net/note/delete/117506/useless
Del: bad code -- https://master.php.net/note/delete/117506/bad+code
Del: spam -- https://master.php.net/note/delete/117506/spam
Del: non-english -- https://master.php.net/note/delete/117506/non-english
Del: in docs -- https://master.php.net/note/delete/117506/in+docs
Del: other reasons-- https://master.php.net/note/delete/117506
Reject -- https://master.php.net/note/reject/117506
Search -- https://master.php.net/manage/user-notes.php