note 71143 added to language.oop5.basic

From: Date: Mon, 13 Nov 2006 23:09:54 +0000
Subject: note 71143 added to language.oop5.basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-119694@lists.php.net to get a copy of this message
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 ---- Server IP: 216.194.113.175 Probable Submitter: 69.180.200.126 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.basic.php Edit -- https://master.php.net/note/edit/71143 Del: integrated -- https://master.php.net/note/delete/71143/integrated Del: useless -- https://master.php.net/note/delete/71143/useless Del: bad code -- https://master.php.net/note/delete/71143/bad+code Del: spam -- https://master.php.net/note/delete/71143/spam Del: non-english -- https://master.php.net/note/delete/71143/non-english Del: in docs -- https://master.php.net/note/delete/71143/in+docs Del: other reasons-- https://master.php.net/note/delete/71143 Reject -- https://master.php.net/note/reject/71143 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119694) next »