Home  |  Linux  | Mysql  | PHP  | XML
From:odessa-gun@ya.ru Date:Mon Oct  6 05:33:06 2008
Subject:note 86159 added to language.oop5.visibility
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;
    }
}

?>
----
Server IP: 91.196.196.241
Probable Submitter: 212.15.152.123
----
Manual Page -- http://www.php.net/manual/en/language.oop5.visibility.php
Edit        -- https://master.php.net/note/edit/86159
Del: integrated  -- https://master.php.net/note/delete/86159/integrated
Del: useless     -- https://master.php.net/note/delete/86159/useless
Del: bad code    -- https://master.php.net/note/delete/86159/bad+code
Del: spam        -- https://master.php.net/note/delete/86159/spam
Del: non-english -- https://master.php.net/note/delete/86159/non-english
Del: in docs     -- https://master.php.net/note/delete/86159/in+docs
Del: other reasons-- https://master.php.net/note/delete/86159
Reject      -- https://master.php.net/note/reject/86159
Search      -- https://master.php.net/manage/user-notes.php

Navigate in group php.notes at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants