
What
is the need for Memento Pattern
|
public class
mementoClass {
private string objState;
//Include constructor with state as parameter and include property to
get/set objState
}
public class safeKeepingClass {
private mementoClass memObj;
//Include methods or properties to get/set memObj
}
public class ownerClass {
private string objState;
//Include property to get/set objState
public mementoClass createInstance() {
return(new mementoClass(objState));
}
public void restoreState(mementoClass memObj) {
objState = memObj.State //State is the property of memObj returning objState
}
}
_______________________________________________________________________
FREE Subscription
Subscribe
to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.
Note
: We never rent, trade, or sell my email lists to
anyone.
We assure that your privacy is respected
and protected.
Visit .NET Programming Tutorial Homepage
______________________________________________________