You are here: Re: Get name of extending class with static method call « PHP « IT news, forums, messages
Re: Get name of extending class with static method call

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация