Comment

Comment by AnthonyMouse

So to summarize, you have a Java function:

  public void f(Foo bar) { ... }
Which is the equivalent C++ function?

  void f(Foo bar) { ... }
  void f(Foo& bar) { ... }
  void f(Foo* bar) { ... }
It's the last one. Java passes everything by value, but non-primitive objects in Java are actually pointers (which Java inaccurately calls references), and the pointer is passed by value.
parent AnthonyMouse 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton