... 单件方法允许给单个对象增加一个方法。singleton methods 类宏(Class Macro) 对象拥有一个特有的隐藏类,称为该对象的eigenclass。 ...
基于5个网页-相关网页
With some implementations of the singleton, you allow writers of subclasses to override methods polymorphically, something not possible with static methods.
最后,在单例模式的一些实现方式中,单例类的子类能够动态地重载方法,这是静态方法所不能办到的。
You can access methods on singleton objects similar to how you would call static methods.
您可以像调用静态方法一样访问单例对象的方法。
You will design the object as a singleton (this design pattern will limit this object to a single instance) and have the appropriate retrieve and store methods to manipulate the cache.
您将把对象设计为一个单子实例 (singleton)(这个设计模式将把这个对象限制在一个单个实例中)并使用合适的检索和存储方法对高速缓存进行操作。
应用推荐