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

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.

主站蜘蛛池模板: 清丰县| 辽宁省| 苏尼特右旗| 甘泉县| 安顺市| 东平县| 竹北市| 马尔康县| 红安县| 西平县| 杂多县| 衡阳县| 叶城县| 安丘市| 太仆寺旗| 德钦县| 上犹县| 色达县| 临夏市| 呼玛县| 延长县| 福贡县| 道孚县| 左贡县| 昭平县| 宝兴县| 蒙山县| 通许县| 大田县| 东丰县| 乌兰察布市| 乌苏市| 会宁县| 历史| 同仁县| 汤原县| 宕昌县| 公安县| 萝北县| 楚雄市| 威远县|