I have an error log class that I use throughout all the files in my project. It allows me to debug and have a greater understanding of what my code is doing. I declare it globally in main.cpp by saying Log errorLog and then use it accordingly. Now, I have been splitting files into multiple files and the way I have always gotten away with using my logger in multiple files by using "extern Log errorLog" and it works great.
Now, I am trying to figure out a way I can do this without simply including an extern at the top. A friend mentioned something about a singleton pattern. Can anyone explain this concept? Does anyone have a different concept that will work.
Thanks!