I learn generics. Richter LinkedList. I have questions about class initialization. Added: There is 2 constructor. First with null. How we can do it with 1 one constructor?
internal sealed class Node<T>
{
public T m_data;
public Node<T> m_next;
public Node(T data) : this(data, null)
{
}
public Node(T data, Node<T> next)
{
m_data = data; m_next = next;
}
public override String ToString()
{
return m_data.ToString() + ((m_next != null) ? m_next.ToString() : String.Empty);
}
}
What is?
public Node(T data) : this(data, null)
{
}
especially (T data)
Why I can do?
public Node(T data, Node<T> next)
{
m_data = data; m_next = null;
}
But I can not do
public Node(T data, Node<T> next)
{
m_data = null; m_next = next;
}