Nesting Classes?
| From: | Clarence Kwei | Date: | Fri, 26 Jan 2001 21:35:42 +0000 |
| Subject: | Nesting Classes? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-36891@lists.php.net to get a copy of this message | ||
I tried to do the following:
class some_class {
var $something;
function select_something () {
$query = "SELECT something FROM something_tb WHERE something =
'$this->something'";
$db = new db_sql;
$db->query($query);
$db->next_record ();
$this->something = $db->Record["something"];
}
}
class another_class {
var $something_else;
function select_something_else () {
$query = "SELECT something_else FROM something_else_tb";
$db = new db_sql;
$something_class = new some_class;
$db->query($query);
while ($db->next_record ()) {
$something_class->something = $db->Record["something_else"];
$something_class->select_something ();
}
}
}
PHP is throwing up an error stating that I can't nest classes. Is this true?
What is the reason for not being able to nest classes? Is there any way
around it or am I thinking about classes incorrectly?
Any help would be greatly appreciated. Thanks very much.
--
Clarence Kwei
ckwei@sciencentral.com
ScienCentral, Inc.
(212) 244-9577 ext. 118
<http://www.stn2.com>
<http://www.sciencentral.com>