The other answers you received about using a static class or singleton pattern are correct.
Please note, however, that this compromises your ability to test. In general, if possible, prefer dependency injection over globally accessible classes. I know that this is not always possible (or practical).
Just on this you should also look at the abstract factory template . This allows you to have a famous factory class that creates the actual instance of the class you are using. For example, to have global access to the logging class, do not directly create a logging class. Instead, use factory log to create one for you and return the interface to the logging class. Thus, it is easier to swap different logging classes.
source share