"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:28cqb.114745$e01.418754@attbi_s02...
"Rasti" <me*********@dbforums.com> wrote... I am trying to translate a C++ script to Java. Are there any differences
between the C++ this-pointer and the Java this-pointer?
In Java 'this' is NOT a pointer. There are no pointers in Java.
And, if you have questions on Java, try a Java newsgroup.
Personally, I think that a question about the similarities and
differences between C++ and Java is on-topic for either C++ or Java
newsgroups. To answer the OP's question, in C++ 'this' is a pointer and in
Java 'this' is a reference, because Java doesn't have pointers. However,
the C++ 'this' pointer is rather strange, because it cannot be reassigned
and cannot be null. It probably should have been a reference. As I
understand it, the main reason it wasn't is because it was invented before
references were.
Joe Gottman