How to get the value of a static object from within that object? <p>I’m trying to create a extern pointer to the value of a static object from within that static object. We’ll call this object Foo.</p> <p>Thus far, the only way I’ve gotten this to work is to create a Supervisor class that Foo inherits from that contains two static type variables. One, called superObject is the actual initialized object. The other, called superPointer, is a double pointer of the same type. Inside of the Foo object I declare an extern pointer named TheSupervisor and assign it a nullptr. Then, from within the Supervisor base class, I use the double pointer superPointer to change the value of TheSupervisor extern pointer to the address of the superObject. Wallah.</p> <p>The goal is here to create a globally accessible reference to this object. Trying my best to avoid singletons and keep things thread safe. I’m just wondering if there’s a better way?</p> <p>I'd post code, but I'd really have to clean it and change it around. I think the description is sufficient. Maybe even simpler, actually.</p> <p>EDIT: As it turns out, for static objects, I can't rely on when and in what order they are constructed. Using a one-phase process won't work for this. Instead, I have to keep relying on a two-phase process such as the one I outlined above. Marking Ilya Kobelevskiy's answer as correct as it demonstrates one way to do it, but again, it should come with a warning when used with static objects.</p>