note 17268 deleted from keyword.extends by vincent
| From: | vincent@php.net | Date: | Mon, 11 Aug 2003 15:34:03 +0000 |
| Subject: | note 17268 deleted from keyword.extends by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-53886@lists.php.net to get a copy of this message | ||
Note Submitter: msopacua@idg.nl
----
In a previous version of the documentation it was explicetely mentioned, but not anymore.
If you extend a class, which has an initialisation function, you need to call that function
explicetely in the extension, or it will not be handled.
Even if you call the extension, from the original itself, to create child objects. IE:
<?php
class A
{
var $cs, $b;
function A
{
$this->cs=mysql_connect();
mysql_select_db("mydb", $this->cs);
}
function make_b_child
{
$this->b=new B;
}
}
class B extends A
{
function B
{
$this->A(); //without this line everything fails.
mysql_query("SELECT COUNT(*) AS total FROM my_table", $this->cs);
}
}