I have completely forgot how to do this, or I'm thinking of another language.
How do I create in instance of an object that can be used throughout all of my .cpp files.
The class is defined in a header file so I'm just wondering if it is done through there.
IE: I have methods that use a class instance, and then in another file, more methods that use the same instance, only problem is, I cannot interface these two instances because it's two unique declarations of the same object, so pretty much, how do I have just one instance of the object that is used by all the functions, thus allowing me to interface between them.
In Java we need to put in a synchronized keyword in case the getinstance() method is called by multiple threads at the same time. So how does C++ solve this problem ?
In Java we need to put in a synchronized keyword in case the getinstance() method is called by multiple threads at the same time. So how does C++ solve this problem ?