Is it possible to have an entity that has itself as an attribute? An example from a piece of code I’m trying to recreate: (class Node has a constructor that takes as an argument an object of type Node) Node(Node parent, int xpos, int ypos, double g, double h) { this.parent = parent; this.x = xpos; this.y = ypos; this.g = g; this.h = h; }
asked
Konstantinos Petridis
2 answers
3
Yep, that is what a self reference will do. Just drag a line from one corner of an entity to any other location on it’s border.
answered
Tim v Steenbergen
0
Now I can access it an attribute through its Java class with the get() methods it generated. Thanks for the help!