public static void Main(string[] args) { Document doc = new Document(); DocumentWriter writer = new DocumentWriter(doc); // Write to the document: writer.Write("Hello world!"); writer.Backspace(); doc.PrintDocument(); // Hello world writer.Undo(); doc.PrintDocument(); // Hello world! writer.Redo(); doc.PrintDocument(); // Hello world writer.Write(" Goodbye!"); doc.PrintDocument(); // Hello world Goodbye! writer.Undo(); doc.PrintDocument(); // Hello world writer.Undo(); doc.PrintDocument(); // Hello world! }