note 45434 added to language.oop5.decon
| From: | taeber at rapczak dot com | Date: | Tue, 07 Sep 2004 08:57:26 +0000 |
| Subject: | note 45434 added to language.oop5.decon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76132@lists.php.net to get a copy of this message | ||
<?php
// Quote from Documentation
"PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such
as Java. The destructor method will be called as soon as all references to a particular object are
removed or when the object is explicitly destroyed."
?>
I think this statement is a bit misleading. Java does NOT implement the destructor concept. The
closest equivalent that comes to mind is the "finalize()" method which is called when an
object is collected by the JVM garbage collector. There is not guarentee, however, that this method
will be called until the program has ended.
The only way to implement this concept in Java is to create a destructor method and call it
implicity from the client code. Again, there is no guarentee that the programmer writting the code
will use this method. Even then, the destructor is not the same as say C++'s destructors which
are functions that are automagically called whenever an object is destroyed.
----
Manual Page -- http://www.php.net/manual/en/language.oop5.decon.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45434
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45434&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45434&report=yes
Search -- http://master.php.net/manage/user-notes.php