I'm writing a script in C++ in visual studio. It'll be reading in Serial data from the arduino. Anyway, I'm new to classes.
The arduino will send temperature values to my c++ program and I wanted to put it in a class. I know that private variables are the ones whose values you obtain and work with, but must this value be constant throughout the entire lifespan of the program? So I was wondering if it would it be bad practice if I made my temperature variable private, and constantly update that private variable.
You should read about classes https://en.wikipedia.org/wiki/C++_classes,
but probably a full C++ beginners futorial would also be useful.
No, why would it need to be constant through the lifespan of the object? Your object reflects a temperature reading so it makes sense that it changes throughout its life.
Whether you need a class to just store a temperature is debatable; it makes sense to use a class if you store e.g. a time and the temperature at that time.
and now I don't have to feel so unsure about it anymore. Thanks PaulS! Thanks sterretje!