note 54112 added to language.oop.newref
| From: | karl at webartjapan dot com | Date: | Fri, 24 Jun 2005 00:27:39 +0000 |
| Subject: | note 54112 added to language.oop.newref | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90869@lists.php.net to get a copy of this message | ||
Is it just me, or does this idea of new returning a copy by default seem counterintuitive?
Indeed, this means that in order to be safe, I must ALWAYS use $a =& new whatever() when using
someone else's library because they might have some hidden backreferences in the class.
I come from a C++ and Java background, and the whole idea of not getting the same copy of an object
as was available in the constructor (by default) just seems like an anthill waiting to happen.
----
Manual Page -- http://www.php.net/manual/en/language.oop.newref.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54112
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54112&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54112&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54112&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54112&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54112&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54112&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54112&report=yes
Search -- http://master.php.net/manage/user-notes.php