Posted by Torsten Roehr on 10/04/72 11:05
"Jason Barnett" <jason.barnett@telesuite.com> wrote in message
news:20050111192629.21621.qmail@pb1.pair.com...
> The only other solution that comes to mind is a little messy but it lets
> you get away with no object. Instead of calling the method statically
> you can use call_user_func_array() with the child class name as a
> parameter. Then change the parent method to accept the child class name
> as a parameter.
>
> <?php
>
> function call_static_child() {
> $drive_args = func_get_args();
> /** assume that first parameter is child of class Car */
> return call_user_func_array(array($drive_args[0], 'drive'),
$drive_args);
> }
>
> ?>
Hi Jason,
thanks for taking a look but there *must* be a way to achieve this without
passing any parameters around. Otherwise I could just do:
Porsche::drive('Porsche');
Best regards, Torsten
[Back to original message]
|