Group Group Group Group Group Group Group Group Group

Why is the Node implemented as a class and not a struct?

I was wondering if anyone could explain why the Node object is implemented as a class instead of a struct. Wouldn’t implementing the Node class as a struct allow it to conform to value semantics? Wouldn’t a struct eliminate the reference behavior of the class?

Struct cannot have a property that recursively contains it. In this case, the property next contains a reference to optional Node

1 Like