开-闭原则就是软件实体应当对扩展开放,对修改关闭.(Software entities should be open for extension,but closed for modification.) 正如牛顿三大定律在经典力学中的位置一样,开闭原则是面向对象的可复用设计(Object Oriented Design或OOD)的基石,是最基础的设计原则,其它的设计原则都是开闭原则的具体形态,也就是说其它的设计原则是指导设计的工具和方法,而开闭原则才是其精神领袖.依照编程语言的称谓,开闭原则是
开闭原则:指的是一个软件实体应对对扩展开发,对修改关闭(Software entities should be open for extension, but closed for modification).这个原则是说在设计一个模块的时候,应对使这个模块可以在不被修改的前提下被扩展,换言之,应对可以不必修改源代码的情况下改变这个模块的行为. 根据开闭原则,在设计一个软件系统模块(类,方法)的时候,应该可以在不修改原有的模块(修改关闭)的基础上,能扩展其功能(扩展开放). - 扩展开放:某模块
原文出自:http://www.cnblogs.com/muzongyan/archive/2010/08/05/1793454.html 开闭原则(Open Closed Principle)是Java世界里最基础的设计原则,它指导我们如何建立一个稳定的.灵活的系统. 定义: 一个软件实体如类.模块和函数应该对扩展开放,对修改关闭. Softeware entities like classes,modules and functions should be open for extensio
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ATM.Day02 { class Bank { public int index; ]; public Account account = new Account(); public CreditAccount credit = new Cred