Skip to main content
GameDev.net gamedev.net
🔒 Locked

singletons or static classes ?

Started by bg3ntl Jan 11, 2002 at 9:11 PM 1 replies 500+ views
Original Post
bg3ntl
bg3ntl
whats better to use - using singletons or just declaring all members and methods of a class static ? is one better than the other for performance ? i have been using just plain static classes for global access but i''ve seen lots of stuff on using singletons. any ideas for me ? thanks guys, bg3ntl
regards,bg3ntl' That's a nice little nothing you are almost wearing. '
Kylotan
Kylotan
The performance difference is negligible, on the occasions where it actually exists. Singletons address the concept of ensuring you only ever have 1 instance of an item, while not losing control over construction order, etc. Static members don''t give you that much control.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
bg3ntl
bg3ntl
thnx for the reply, makes it clear now

bg3ntl
regards,bg3ntl' That's a nice little nothing you are almost wearing. '

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.