Re: Extending a class with a static constructur (like PEAR::DB)

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

 



Weston wrote:

> >  $dte = DBToyExt::connect("mysql://weston_tssa:******@localhost/weston_tssa");
> >
> >  $dte->testext('testing');
> >  $dte->testext($dte->moo);
> >  $dte->testext($dte->bar);

On Fri, Mar 10, 2006 at 10:43:02AM +1100, Chris wrote:

> $dte will only have the return value of DBToyExt::connect() - it won't
> allow you to access other methods in the class.
>
> You'll need to:
>
> $dbtoy = new DBToyExt();
> $dbtoy->connect(....)
> $dbtoy->testext('testing');

Thanks! Works like a charm:

http://weston.canncentral.org/web_lab/mlib/DBToyExt2.php

That's interesting. I think I just sortof expected that since the canonical
invocation is through a statically called method, calling it by dereferencing
a specific object wouldn't work. 

Does anyone know if that would also work in PHP 5?

If not, is there another way to do what I'm trying to do?

Thanks,

    Weston

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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