note 27752 rejected from keyword.extends by didou
| From: | didou@php.net | Date: | Fri, 17 Oct 2003 12:16:48 +0000 |
| Subject: | note 27752 rejected from keyword.extends by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58763@lists.php.net to get a copy of this message | ||
Note Submitter: duda_y@yahoo.co.uk
----
Why should I call parent::callClass()
//multipleInheritance
class multipleInheritance
{
function callClass($class_to_call)
{
return new $class_to_call();
}
}
class A
{
function insideA()
{
echo "I'm inside A!<br />";
}
}
class B
{
function insideB()
{
echo "I'm inside B!<br />";
}
}
class C extends multipleInheritance
{
var $a;
var $b;
function C()
{
//global $a,$b;
// $this->a = parent::callClass('A');//no effect
// $this->b = parent::callClass('B');//no effect
// can't we write like this?
$this->a =& new A();
$this->b =& new B();
}
function insideA()
{
// global $a,$b;
$this->a->insideA();
}
function insideB()
{
//global $a,$b;
$this->b->insideB();
}
function insideC()
{
echo("I'm inside C!
");
}
}