I have been trying to create a fucntion that gets the time, only when I create it I cant make it see that the device has been created >_< you know what I mean something like public, protected and private.
Ehh, yeah, C++ Primer, second chapter (the one after introduction...). You cannot use things from other classes without getting a handle to it. Assuming that device is not a global variable, how should SetTimer know where to find your "device"? Either give it a device parameter or use some other means to tell it to that function.
arras wrote:If you do not like it (some people don't for some strange reason)
whats strange about this? it is simply bad style of coding to use globals when not necessary. if working on a big (e.g. commercial) project which uses a lot of globals, it is easy to see why that is a bad idea in most cases.
loki1985 wrote:whats strange about this? it is simply bad style of coding to use globals when not necessary.
There is nothing bad with globals, they are standard part of C++. Bad can be only way you use them. But that would be your fault not fault of bad globals. Just anything can be used in a wrong way but that is not reason to call it bad or tell others to not use it.