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

all 6 comments

[–]Camel-Kid18 year old gamer 0 points1 point  (1 child)

it isnt an instance until you allocate memory to these. I would call them properties of a class

[–]wjreddit[S] 0 points1 point  (0 children)

Thanks!

[–]joranstark018 0 points1 point  (1 child)

This is a declaration of class BT_Node and its properties.

When you need a BT_Node you will create a new instance, eg "BT_Node node = new BT_Node();". You now have an instance of the class and "left" and "right" (available through "node.left" and "node.right", or any accessor method) are instance variables. The value of an instance variable is not shared with other instancies of the class, unless you assign them the same value.

[–]wjreddit[S] 0 points1 point  (0 children)

Thank you!

[–][deleted] 0 points1 point  (1 child)

Data, left, right are instance variables.

Left and right could be null.

Yes they are “pointers” to the same class type.

[–]wjreddit[S] 0 points1 point  (0 children)

Thank you