note 91910 added to language.oop5.paamayim-nekudotayim
| From: | RocketInABog at techno-monks dot net | Date: | Wed, 01 Jul 2009 10:31:27 +0000 |
| Subject: | note 91910 added to language.oop5.paamayim-nekudotayim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157753@lists.php.net to get a copy of this message | ||
It seems some people were as confused as myself with a certain use of the Scope Resolution Operator
(::) in php.
Here is what I wish the documentation said explicitly.
The signature for calling a static/class method and the signature for calling an instance method
look identical in php, yet operate differently.
The instance method handles "$this" as expected, and the static/class method (naturally)
does not.
In other words; working from Example #3, above (condensed below):
<php?
class OtherClass extends MyClass{
public function myFunc()
{ parent::myFunc(); }
}
?>
When calling "parent::myFunc();"
.. although "$this" is not (visually) used in the method call,
the parent instance method is successfully called with the proper instance ('OtherClass')
of "$this" .
So far, I haven't encountered any language that does this, other than php.
That aside, PHP is still my friend.
----
Server IP: 208.69.120.35
Probable Submitter: 75.72.168.175
----
Manual Page -- http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php
Edit -- https://master.php.net/note/edit/91910
Del: integrated -- https://master.php.net/note/delete/91910/integrated
Del: useless -- https://master.php.net/note/delete/91910/useless
Del: bad code -- https://master.php.net/note/delete/91910/bad+code
Del: spam -- https://master.php.net/note/delete/91910/spam
Del: non-english -- https://master.php.net/note/delete/91910/non-english
Del: in docs -- https://master.php.net/note/delete/91910/in+docs
Del: other reasons-- https://master.php.net/note/delete/91910
Reject -- https://master.php.net/note/reject/91910
Search -- https://master.php.net/manage/user-notes.php