Declaration of Node

While creating a node, we can use both structure and a class. Which is better and why?

Class is better as class provides encapsulation and provides more security to data, but for solving problems you can use whichever you want (class/structure).

1 Like