Re: Re: static/object method
| From: | Hans Lellelid | Date: | Thu, 24 Jun 2004 11:10:11 +0000 |
| Subject: | Re: Re: static/object method | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10751@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
the E_STRICT warnings on static calls to non static methods are probably usefull, (as $this could be defined totally randomly), so it does make some sense.. btw: does that mean: class a { function find() { } } class b extends a { function find() { } } // call the toplevel parent method.. (skip the imediate parent) class c extends b { function find() { a::find() } } $a = new c; $c->find(); illicits and E_STRICT warning???Hmm --yes unless you declare a::find() as a 'static' method. The good news is that static methods can be used on objects w/ no errors (so you can definitely accomplish that design, but would just have to declare methods as 'static'). So, basically: - if you try to call a "normal" method statically you will get E_STRICT notice - if you make any reference to $this in a 'static' method you will get E_FATAL error (Correct me if I'm missing anything) Hans