Re: Using grand-parent constructor
| From: | Hannes Magnusson | Date: | Tue, 31 Oct 2006 21:45:51 +0000 |
| Subject: | Re: Using grand-parent constructor | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26290@lists.php.net to get a copy of this message | ||
GrandParent::__construct();
On 10/31/06, Evert | Rooftop <evert@rooftopsolutions.nl> wrote:
Yes, but I want to ignore Parent behaviour, and Re-inherit GrandParent behaviour.. Evert Jasper Bryant-Greene wrote: adding parent::__construct() in the constructors of both Parent and Child should do what you want. Jasper Evert | Rooftop wrote:-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpHi List, Sorry if this is the wrong list for this kind of stuff.. I'd be happy to re-post this to the users mailing list. With the recent updates that will raise E_STRICT on static calls that are non static, how do we properly do the following.. I have a class named 'GrandParent' a class named 'Parent' and a class named 'Child' GrandParent has a constructor, Parent overrides it and Child does too.. What if I want to call GrandParent's constructor from the child? Most languages allow this through casting the class into the ancestor and call then call the method, but I can't do this with PHP, or can I ? The other solution (right now) would be GrandParent::__construct(), but this is not OOP anymore.. So it seems kind of weird that we get limited in functionality, for OOP-ness, but not adding the functionality to solve common design problems that we're raised by introducing this.. Will we get casting in the future? Evert