Ok, I have a parent class (CMS) and a child class (WebSite extends CMS).
There is some important stuff going on in the constructor for CMS that I
think should be happening when I instantiate a new WebSite.  Look at the
following example:

<?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?


-- 
Joshua Groboski
Programmer Analyst
SAVVIS Communications Inc.
http://www.savvis.net



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

Reply via email to