Hello. I have tried several chat rooms, and many google searches, but I havent found an answer to my problem.
How can I share a variable between 2 different classes that are in 2 different CPP files?
Methods I have tried:
1. Making the variable in one class Public.
-> This failed because the classes are not in the same .cpp file. (This is what I was told in yahoochat room)
2. Making each class a Friend of the other class.
-> This failed for the same reason, I believe.
3. I tried making a 3rd dummy class in a header file. The contents of this class was a public variable, and both the other classes were added as friends. Then I #included this header in both files.
-> This too didnt work, but I dont know why.
Thank you for any suggestions. If it helps, what Im trying to do is use framerate data from an opengl view copied into a global string which then is used in the status bar. No matter what Ive tried, I cant get the two classes in the two files to share the string.