Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

138 Neutral

About alexk7

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I know two cases where a singleton may be useful: 1) The class is part of a class hierarchy and needs to override some virtual functions. For example, it can be useful to have a "dummy" or "empty" object that does nothing. It would be a waste to create several such objects. In this case, you get the object with the Instance() function but you still pass the pointer in a bigger system that is unaware of the existance of the singleton. 2) You have only one instance right now, but you plan to have several later. In this case, the change will be smaller if the object is defined as a class in the first place. Otherwise, a namespace with functions that "privately" access data defined in the source file (.cpp) is a much better approach I think. It separate interface and implementation even more than a class without the cost of using virtual functions (which are the way to separate those with classes) alexk7 [Edited by - alexk7 on July 7, 2004 7:29:46 PM]
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!