Re: OOP
| From: | Aral Balkan | Date: | Sun, 24 Jun 2001 01:39:49 +0000 |
| Subject: | Re: OOP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55004@lists.php.net to get a copy of this message | ||
As I understand it in PHP the constructor of the parent class is not called
when a child class is initiated.
You can call it manually. Eg., using your example:
class one
{
function one()
{
echo "one ";
}
}
class two extends one
{
function two()
{
one::one();
echo "two ";
}
}
class three extends two
{
function three()
{
two::two();
echo "three";
}
}
$foo = new three();
$foo should now equal 'one two three'. (:: lets you access functions from
within a class without explicitly declaring a new object).
Hope this helps (PS. The PHP Developer's Cookbook by Sterling Hughes has a
short but good chapter on classes).
Aral :)
______________________________
(aral@kismia.com)
New Media Producer, Kismia, Inc.
(aral@american.edu)
Adj. Prof., American University
??????????????????????????????