In the code below, I want to access StackElement.below in LinkStack.Pop(), so I cannot decorate StackElement.below as private. However I also don't want to make it public because it's not safe if any other class can access the property. What should I do then? Thanks in advance.
public class StackElement
{
public int value;
public StackElement below;
}
public class LinkStack
{
private StackElement topElement;
private int count, capacity;
void Pop()
{
topElement = topElement.below;
}
}