I'm trying to learn my way around C++ by making a simple game/engine with SDL2. Currently I'm having some issues trying to make a static class.
I think the easiest way is to just describe what I want to achieve:
I hope this was somewhat understandable.
(Pointer is a terrible class name.)
You want a class such that only one instance can exist at a time, and it is accessible to any code that is aware of the class. The solution is the Singleton Pattern. It is a badly overused pattern (novices like to use it as a substitute for global variables) but this is exactly the kind of thing it's good for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With