I have this class:
public class Node
{
public int Data;
public Node Next;
}
and this interface:
public interface IMyList
{
Node Head { get; set; }
void Add(int elm); // add new element
void PrintAll(); //print all list
void Reverse(); // reverse list, implement without using helpers collection\arrays
}
and I need to implement the interface to use all it's inner functions
this is my class that implements the interface:
public class MyCustomizedList : IMyList
{
Node IMyList.Head { get; set ; }
public void Add(int elm) { /*something goes here*/ } // add new element
public void PrintAll() { /*and here*/ } //print all list
public void Reverse() { /*and also here*/ }
// reverse list, implement without using helpers collection\arrays
}
but I don't understand how do I gain access to the fields of class Node for example If I want to Implement the function Add() how do I set the fields of the inner Node Class to attach pointer to the Next Node and the elm value to it's data?