ID: 19463
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
-Bug Type: Class/Object related
+Bug Type: Zend Engine 2 problem
Operating System: Mandrake Linux 8.2
PHP Version: 4CVS-2002-09-18
New Comment:
Reclassified.
Previous Comments:
------------------------------------------------------------------------
[2002-09-18 01:23:51] [EMAIL PROTECTED]
The version is actually the 4.3.0 zend2 alpha2.
I'm wondering if it is possible to return an instance of a subclass
from a constructor. For example:
class test1
{
class test2
{
function prt_test()
{
echo("testing!!!");
}
}
function __construct()
{
return new test2();
}
}
$test_obj = new test1();
$test_obj->prt_test();
?>
Let's say that I want to parent class to choose one of it's children to
actually provide the functionality based on some selection criteria.
This isn't a big issue since I can just use a function seperate from
the constructor to accompolish roughly the same thing. I'm just
wondering if this is something that was considered or encountered
already.
Thanks...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19463&edit=1