This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Global Class Decleration

Hi,

I am using uVision4 for LPC3250.

I declare my class in my header file and define its functions in the corresponding cpp file.

My question is this, how can I reach the object of this class when I create it in another file.

For example, in a.cpp:

MyClass MyObject;

in b.cpp

MyBoject.value = 5;

I want my object to be global.

Thanks for your helps.

Parents
  • Even better to read a good C++ book if the program is using C++.

    I normally have a global.h with extern declarations for more important global variables.

    Less important variables are either exported the module-specific header file, or have an accessor function in case it's a singleton.

    Overall, C++ is great for keeping down the number of symbols in the global namespace.

Reply
  • Even better to read a good C++ book if the program is using C++.

    I normally have a global.h with extern declarations for more important global variables.

    Less important variables are either exported the module-specific header file, or have an accessor function in case it's a singleton.

    Overall, C++ is great for keeping down the number of symbols in the global namespace.

Children
No data