Greetings I've been studying data structures and I've run into a very curious syntax and I've been trying to find answers and I have not found them.
public class CNodo
{
//Aqui colocamos el dato o datos que guarda el nodo
private int dato;
//Esta variable de referencia es usada para apuntar al nodo siguiente
private CNodo siguiente = null;
//Propiedades que usaremos
public int Dato { get => dato; set => dato = value; }
internal CNodo Siguiente { get => siguiente; set => siguiente = value; }
//Para su facil impresion
public override string ToString()
{
return string.Format("[{0}]", dato);
}
}
I have created a class called CNodo
and within it I declared a variable called siguiente
of type CNodo
. The code does not have any errors. But I have a confusion. I have seen these types of variables in several codes and I still do not understand their functionality.
Do I want an explanation about the usefulness of these variable declarations?
Thank you very much.