instance_flag=false; //true if 1 instance
public PrintSpooler() throws SingletonException {
if (instance_flag)
throw new SingletonException(\ else
instance_flag = true; //set flag for 1 instance System.out.println(\ }
//------------------------------------------- public void finalize() {
instance_flag = false; //clear if destroyed }
}
/**************** 改错结束 ******************/ 面向对象的原则
1,The Open/Closed Principle (OCP) 2,The Liskov Substitution Principle (LSP) 3,The Dependency Inversion Principle (DIP) 4,The Interface Segregation Principle (ISP)
5,The Reuse/Release Equivalency Principle (REP) 6,The Common Closure Principle (CCP) 7,The Common Reuse Principle (CRP)
36
设计模式
8,The Acyclic Dependencies Principle (ADP) 9,The Stable Abstractions Principle (SAP)
37