I don't want to share this variable with the code that includes my library. I tried "private" but it fails. If I have a boolean x; in the main code that includes this library, I have a conflict of names so I had to do boolean mylib_x;
So what is the keyword opposite of "public"? It seems like whatever I defined in the library's cpp is public by the compiler, otherwise won't have naming conflict.
FYI, the definition of x is in .cpp, not in .h
Thanks for reading.
It seems like whatever I defined in the library's cpp is public by the compiler, otherwise won't have naming conflict.
Where is the variable defined? If it is in a function, the variable is local to the function, and not available to other methods or anywhere outside of the file.
If it is outside any function, it is a global variable, and not in keeping with the spirit of classes.
Paul,
Thanks. The variable is defined outside the functions, to be shared by all functions int the library. The library is a collection of utility functions like printf. I have not found a need to instantiate multiples of this library. It is pretty much like printf, there is only one output device, which is the serial monitor for printf, and LCD for my lib functions. If it were like a button, then I'll use class.