note 86159 deleted from language.oop5.visibility by danbrown
| From: | danbrown@php.net | Date: | Fri, 21 Nov 2008 20:17:03 +0000 |
| Subject: | note 86159 deleted from language.oop5.visibility by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146802@lists.php.net to get a copy of this message | ||
Note Submitter: odessa-gun at ya dot ru
----
PHP 5.2.3, windows
The comment in this example is invalid
<?php
/**
* Define MyClass2
*/
class MyClass2 extends MyClass
{
// We can redeclare the public and protected method, but not private
protected $protected = 'Protected2';
function printHello()
{
echo $this->public;
echo $this->protected;
echo $this->private;
}
}
?>
Just try this:
<?php
class MyClass2 extends MyClass
{
// We CAN redeclare the public, protected and private PROPERTIES in this example
public $public = 'Public2';
protected $protected = 'Protected2';
private $private = 'Private2';
function printHello()
{
echo $this->public;
echo $this->protected;
echo $this->private;
}
}
?>