Domanda di colloquio di Algotec

there is a paint program, how do you implement a undo method?