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

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.

主站蜘蛛池模板: 聂荣县| 奉新县| 浏阳市| 北宁市| 宝清县| 通山县| 乐安县| 崇阳县| 鹰潭市| 兴业县| 扶风县| 鹤庆县| 明光市| 大渡口区| 乡宁县| 德兴市| 大余县| 靖安县| 江西省| 淮安市| 探索| 万山特区| 阳朔县| 罗田县| 扎囊县| 平凉市| 寿宁县| 台北市| 台山市| 鄂伦春自治旗| 龙海市| 克山县| 偃师市| 甘谷县| 莱芜市| 凤山市| 海淀区| 云梦县| 太白县| 伊吾县| 浮山县|