摘要
目前OO界有几个原则:“开-闭”原则(OpenClosedPrincipal)、里氏代换原则、合成复用原则,循此原则,又提出了许多设计模式。本研究利用“抽象工厂”模式思想,结合案例分析了使用接口的本质,指出了“什么时候该使用接口”;定义了一个用于创建对象的类,使一个类的实例化延迟;指出了“如何使用接口”;用“开-闭”原则分析了继承的本质,继续结合该案例,提供一个抽象工厂用于继承,解决代码的“开放”。
At present,OO(Object-Oriented) field has several principles:Open Closed Principal,Liskov Substitution Principle,Composite/Aggregate Reuse Principle etc.By this principle,has given a lot of Design Pattern in Java again?Using the Patterns of 'Abstract Factory'and related the case,this text analysis essence of uses the interface ,and have pointed out 'when to deserve to use the interface'. Using the Patterns of 'Abstract Factory' define a class of target to use for object,and make pieces of instance delay,and have pointed out 'How to use the interface';By the Open-Close principle and continue to relating this case,it has analysed the essence of inheritted ,provided an abstract factory for inheritining ,so solved 'opening'of the code.
出处
《山西青年管理干部学院学报》
2005年第3期75-77,共3页
Journal of Shanxi College For Youth Administrators
关键词
接口
类
OO
抽象类
继承
Interface
Abstractor Class
Class
OO
Inherit,