Re: Extending a class with a static constructur (like PEAR::DB)
| From: | Andreas Korthaus | Date: | Fri, 10 Mar 2006 09:51:53 +0000 |
| Subject: | Re: Extending a class with a static constructur (like PEAR::DB) | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231752@lists.php.net to get a copy of this message | ||
weston@leary.csoft.net wrote:
Ahhh! I'd kept thinking what connect() returned was a db object, but it does look like it returns varying objects depending on which database you're using.correct
Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods would be inhereted by any object?But DB_mysql will not inherit from your object! Look at the source: class DB_mysql extends DB_common {...} If you inherit from a class, the parent class will not inherit your (the child classes) methods. If a class should inherit from your object, it must explicitly inherit from that class. Best regards Andreas