Well-known object types can be either single call or singleton.
已知物件型别可以是单一呼叫或单一物件。
We could either implement each state as a Singleton, or create a factory of states which creates and manages the states.
我们既可以执行每个状态作为 Singleton,也可以创建一个状态工厂用于生成和管理状态。
Users of the class can then add and remove Attendee elements from the collection the Singleton instance holds, or replace the elements in the collection.
然后,该类的用户可以在 Singleton 实例保存的集合中添加和删除 Attendee 元素,或替换集合中的元素。
应用推荐