I am trying to implement memento design pattern in my project to add and remove products from cart.
I have abstract product class and sub classes like Book, Software, Phones etc..
I googled and found some examples using three classes :
I still can't figure how do I use them to add and remove products(undo last product products) each time.
Will appreciate,if you could provide me the structure or an example would be better.