Question d’entretien chez Algotec

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