This program works ok, (but List is no Range)

```
class Node {
        int data;
        Node next;
}

class List {
        Node node=null;
        this(int[] AR){foreach(i ; AR)pushfront(i);}
        bool empty() const {return !node;}
        void popFront() {node=node.next;}
        float front() const {return node.data;}
        void pushfront(int data) {
                Node newnode=new Node();
                newnode.data=data;
                newnode.next=node;
                node=newnode;
        }
                
}//List

void main(){
        List l=new List([3,2,1]);
        Node backupnode=l.node;
        l.writeln();
        l.node=backupnode;//Restore state destroyed by writeln
        l.writeln();
}
```

Reply via email to