ddownn
1
Like return this;
or return new ClassName(this)
or something like that…
Of course I tried and it didn’t work, so I thought I’d ask if it’s possible.
I’ve made a new Line class, and the following seems to work, I was just hoping for a shortcut to avoid having to call a constructor.
Line getLine() {
return new Line(x1, y1, x2, y2);
}
1 Like
You can use clone() in place of new
:
3 Likes
ddownn
3
Nice, thanks for the explanation in the link
1 Like