<p>In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class.  In Java, I'd use:</p>

<pre><code>public class MyObject {
    private static final MySharedObject mySharedObjectInstance = new MySharedObject();
}
</code></pre>

<p>Or, if MySharedObject needed more complicated initialization, in Java I could instantiate and initialize it in a static initializer block.</p>

<p>(You might have guessed...  I know my Java but I'm rather new to Delphi...)</p>

<p>Anyway, I don't want to instantiate a new MySharedObject each time I create an instance of MyObject, but I do want a MySharedObject to be accessible from each instance of MyObject.  (It's actually logging that has spurred me to try to figure this out - I'm using Log4D and I want to store a TLogLogger as a class variable for each class that has logging functionality.)</p>

<p>What's the neatest way to do something like this in Delphi?</p>

Before version 7, Delphi didn't have static variables, you'd have to use a global variable.
To make it as private as possible, put it in the
```
implementation
```
section of your unit.