how do I create and use a global class? I have only created global variables, never a class; I tried to use the same formate but came across errors.
what I tried to do was declare the class at the top of my driver file:
Code:(driver file) #include <normalStuff> class MyGlobalClass gClass; // IS THIS HOW I DECLARE A GLOBAL CLASS class DriverClass{ private: ... // normal stuff public: void start(void); ...// normal stuff }; int main(void){ DriverClass dc; dc.start(); // this is where I will put values in the global class ...blah blah blah }Code:(some other file who wants to access the global class) #include <normalStuff> extern class MyGlobalClass gClass; // IS THIS HOW I GET ACCESS TO THE GLOBAL CLASS? void class2::function(){ double temp; temp = gClass.data; // THIS IS WHAT GIVES ME AN ERROR ... }



LinkBack URL
About LinkBacks


