note 94655 added to language.oop5.abstract
| From: | nathan dot vorbei dot tech at gmail dot com | Date: | Tue, 17 Nov 2009 06:55:50 +0000 |
| Subject: | note 94655 added to language.oop5.abstract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162969@lists.php.net to get a copy of this message | ||
"additionally, these methods must be defined with the same (or a less restricted)
visibility."
The words were not restricted in abstract class but also normal classes,
the method in child Class which overwrites the parent Class can also change the the visibility of
the method to same or less restricted.
for example:
<?php
class ClassOne {
protected static $staticone = 'nathan';
protected function changestaticone() {
return self::$staticone = 'john';
}
}
class ClassTwo extends ClassOne {
public function changestaticone() {
return self::$staticone = 'Alexey';
}
}
$classtwo = new ClassTwo();
echo $classtwo->changestaticone();
----
Server IP: 222.73.227.205
Probable Submitter: 218.82.6.90
----
Manual Page -- http://www.php.net/manual/en/language.oop5.abstract.php
Edit -- https://master.php.net/note/edit/94655
Del: integrated -- https://master.php.net/note/delete/94655/integrated
Del: useless -- https://master.php.net/note/delete/94655/useless
Del: bad code -- https://master.php.net/note/delete/94655/bad+code
Del: spam -- https://master.php.net/note/delete/94655/spam
Del: non-english -- https://master.php.net/note/delete/94655/non-english
Del: in docs -- https://master.php.net/note/delete/94655/in+docs
Del: other reasons-- https://master.php.net/note/delete/94655
Reject -- https://master.php.net/note/reject/94655
Search -- https://master.php.net/manage/user-notes.php