Im trying to create some dummy code where child classes can talk to each other.
Im looking to verify some behaviour Im running into.
When a child extends a parent, from that point on, the parent, has no idea,
on what the child is capable of, or what it contains.
Is that a "real" parent??? ;)


With this script Im getting ->
Fatal error: Call to undefined function: execute() in /files/www/data/misc/mpn2/index.php on line 47*


*------
<?php

$foo = new base;
$foo->displayPage();

class base
{
   var $var;

   function base()
   {
       $this->var['db']  = new db;
       $this->var['tpl'] = new smarty;
   }

   function displayPage()
   {
       return $this->var['tpl']->display();
   }
}

// middle man
class mm
{
}

// child class
class db extends mm
{
   var $db = 'database';

   function execute()
   {
        return 'execute';
   }
}

// child class
class smarty extends mm
{
   var $smarty = 'smarty';

function display()
{
// By the time we are here, both smarty and db are children of mm
// Is it normal for mm to not know what the children are capable of???
var_dump(parent::execute());
return 'display';
}
}


?>

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



Reply via email to