originator.cc 317 B

123456789101112131415161718
  1. #include "originator.hh"
  2. void Originator::setState(std::string state){
  3. this->state = state;
  4. }
  5. std::string Originator::getState(){
  6. return state;
  7. }
  8. Memento* Originator::saveStateToMemento(){
  9. return new Memento(state);
  10. }
  11. void Originator::getStateFromMemento(Memento* memento){
  12. state = memento->getState();
  13. }