lundi 16 août 2021

Good example of Singleton usage

Recently I've read a lot about the Singleton pattern. As far as I'm concerned singleton objects should be used only if there is no sense to have more than one, and when there is a need to access them from all over the program. My question is fairly simple and for educational purposes. When making a board game simulator such as Monopoly or Catan is it correct to create Dices (throwable board game dices) as a singleton class?

Aucun commentaire:

Enregistrer un commentaire