3 ms·
A static class member function would be the same in your example. If you don't have any state to maintain, then that's fine. The reason people use singletons is
by adzm 8mo ago
A static class member function would be the same in your example. If you don't have any state to maintain, then that's fine. The reason people use singletons is to manage that state; it's easier to handle it all in a class instance. If you end up having to manage it in a function using globals or static instances somewhere you get the same issues. Also often the object exposed as a Singleton is not the only use of that object.