note 16614 deleted from language.oop by jimw
| From: | jimw@php.net | Date: | Tue, 06 Nov 2001 22:01:42 +0000 |
| Subject: | note 16614 deleted from language.oop by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20530@lists.php.net to get a copy of this message | ||
It seems impossible to define a member function with a name of
ANY function already existing in PHP namespace. For me that's weird.
This DOES NOT work in PHP 4.0.6:
---
class Useless {
function print ($s) {
echo $s;
}
}
$junk = new Useless;
$junk->print ("hello");
---
, giving out
Parse error: parse error, expecting `T_STRING' in script.php on line 4
Renaming member function 'print' into something unique like
'myPrint' makesthe thing work, but that's against the whole OOP encapsulation
principle!
To the editors - please comment. I'm totally exhausted
trying to find the explanation in manuals - name conflict
issue is not covered. If there's a configuration option that
will 'unlock' this limitation, it MUST be clearly described
on this chapter. If the limitation is fatal, it must be
stated under 'This code will not work:'