note 91910 rejected from language.oop5.paamayim-nekudotayim by danbrown
| From: | danbrown@php.net | Date: | Wed, 01 Jul 2009 12:39:11 +0000 |
| Subject: | note 91910 rejected from language.oop5.paamayim-nekudotayim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157769@lists.php.net to get a copy of this message | ||
Note Submitter: RocketInABog at techno-monks dot net
----
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.