这是一个常用的模式:延迟实例化,只有当它确实需要的时候才实例化该对象。
This is a common pattern: Lazy Instantiation puts off creating the object until it is actually needed.
如果没有延迟处理,就会发生这样的情况:仅仅对泛型模板的基本字段定义进行处理,就会引起对这个模板的同一版本的实例化。
Without the deferred processing, you could run into a situation where just processing the basic field definitions for a generic template would require instantiating a version of that template.
定义一个用于创建对象的接口,让子类决定实例化哪一个类。工厂方法使一个类的实例化延迟到其子类。
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
应用推荐