Re: About PHP Implements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 18, 2007 5:45 PM, Chris <dmagick@xxxxxxxxx> wrote:

> Jim Webber wrote:
> > Hello I have a PHP4 server and I'm trying to figure out how to do
> > "implements" on classes. Is there an analogous way to do this without
> > PHP5 installed?
>
> If you're using inheritance and child classes you could do it in a way,
> eg:
>
> class parent_class
> {
>   function x()
>   {
>     echo 'You need to override this fn in your child class';
>   }
> }
>

except that you have to waste usage of the extends keyword just to
'implement' parent_class.  you can only implement one interface in this way.
there is no way to reasonably emulate the interface construct in php4.
in c++ you can emulate the interface construct by having a class that is
entirely virtual, but too bad; php4 doesnt have abstract classes either.
i recommend an upgrade to php5.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux