note 110850 deleted from language.operators.increment by googleguy
| From: | googleguy@php.net | Date: | Sat, 15 Dec 2012 02:20:26 +0000 |
| Subject: | note 110850 deleted from language.operators.increment by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192543@lists.php.net to get a copy of this message | ||
Note Submitter: f74 at nil
----
<?php
in reply to previous note...
class a {
private $foo = 1;
}
class b extends a {
public function inc() {
echo ++$this->foo;
}
}
$b = new b;
$b->inc();
?>
$foo is private, so can't be accessed by its children.
Simply change private for protected and ++$this->foo equals 2.