* Thus wrote Joshua Groboski ([EMAIL PROTECTED]):
> 
> <?php
> class CMS {
>   var $prop1 = "a";
>   function CMS(){
>     $this->prop1 = "A";
>   }
> }
> 
> class WebSite extends CMS{
>   var $prop2 = "b";
>   function WebSite(){ }
>   function setProp2(){
>     $this->prop2 = $this->prop1;
>   }
> }
> 
> $ws = new WebSite();
> echo "Before: " . $ws->prop2 . " : " . $ws->prop1 . "\n";
> $ws->setProp2();
> echo "After: " . $ws->prop2 . " : " . $ws->prop1 . "\n";
> ?>
> 
> If you run this, you'll notice the constructor for CMS is never called.  Is
> this a by-design functionality, am I wrong about what I think should happen,
> or am I just totally off my rocker?
 
PHP 4.0 does not have full support in what most people think should
happen.  you will need to call the inherited constructor inside the
child.

function WebSite() {
    $this->CMS();
}


PHP 5.0 has a lot of changes but still is in development ATM.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

Reply via email to