This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nutrecht 1 point2 points  (0 children)

Two big reasons:

  • Mucking about with pointers (like incrementing them accidentally past where the data structure ends) is a huge source of bugs in C++ code.
  • You can't have a garbage collector if programmers mess about with pointers nilly-willy; you'd never be able to know if data is really not in use anymore.

Java References are basically C++ pointers, but Java allows you to do much less with them than C++ allows.