note 71143 deleted from language.oop5.basic by colder
| From: | colder@php.net | Date: | Sun, 19 Aug 2007 23:44:04 +0000 |
| Subject: | note 71143 deleted from language.oop5.basic by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129617@lists.php.net to get a copy of this message | ||
Note Submitter: nicholas at nicholaswilliams dot info
----
Note that you cannot nest classes (as of <5.1.2; higher versions are not available yet in my
distribution). So, the following
<?php
error_reporting( E_ALL | E_STRICT );
class MyParent
{
public function parentFunction( )
{
}
class MyChild
{
public function childFunction( )
{
}
}
}
$x = new MyParent();
?>
Generates the error "Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in
[filename] on line 12". This is contrary to typical OO programming (specifically Java).
Hopefully they'll change it sometime soon.
I know in part this is a feature request, but I'm also putting it here in case anyone's
looking for information about it: simply, you can't yet do it.
Nicholas