官术网_书友最值得收藏!

The memento pattern

Encapsulation is one of the fundamental principles of object-oriented design. We also know that each class should have a single responsibility. As we add functionality to our object, we might realize that we need to save its internal state to be able to restore it at a later stage. If we implement such functionality directly in the class, the class might become too complex and we might end up breaking the single responsibility principle. At the same time, encapsulation prevents us having direct access to the internal state of the object we need to memorize.

主站蜘蛛池模板: 漳浦县| 汤原县| 山东| 庆安县| 巴彦淖尔市| 临沧市| 武穴市| 昌江| 民权县| 怀安县| 汝南县| 银川市| 诸暨市| 盐亭县| 梅河口市| 易门县| 合肥市| 常宁市| 哈巴河县| 九龙县| 桃江县| 镇平县| 合江县| 江永县| 博爱县| 海丰县| 纳雍县| 两当县| 时尚| 孟连| 余江县| 清流县| 合肥市| 大化| 宝坻区| 军事| 阜新市| 岐山县| 乐安县| 称多县| 库伦旗|