Focusing on the checkTime(); function I THINK that this will work. I had a ton of global vars before I started moving to custom classes (haven’t moved very far yet) and those vars were there for different functions and to pass values between them. Now that I have an object with those private vars I believe they will be referenced when that particular instance is used to call the function. Is that accurate?
There's a few problems here - firstly adding () to an instance constructor actually makes this a function call, so let's drop the ()
Secondly, you're declaring two objects with the same name. That's just not going to work, even though they are different types - each variable has to have a distinct name within the given scope.
The checkTime() function will work as you assumed - note that the function declaration includes start and start parameters.
But the function definition doesn't. The definition is correct, so you should drop these parameters from the declaration:
bool checkTime();
The implementation will work but it can be simplified:
Thanks! So because it is a bool return I can just check the condition in the return and the result is returned? Still lots to learn! The header not matching implementation was my forgetting to update the definition.
Can an object have instances(?) of multiple classes? In essence I want one object that has Time related pieces from the previously viewed class and Functionality from another class. Things that actually interact with physical objects sort of stuff.
Fair point, but this may or may not be the case - it depends upon what the OP means by _start and _stop.
I'm not completely certain what units _start and _stop are given in, but since they are uint32_t I assumed it was milliseconds or seconds after some reference time (either the epoch or system startup.) @LukeUSMC - can you clarify?
Epoch is correct. i got some great advice about working with time and that epoch makes time easy to work with. When I need human readable version of the time stamp I just the built in Time functions to display the entry.
While the way I was doing it easier to read I like your approach as it visually indicates the goal. If now falls between start and stop its true. Something easily gathered just by a glance. Lots of great tips. I’ve read a few C++ style guides (google’s was very insightful) and I know prefixes, camelCase, etc can be a religious argument but…is the leading _ a good approach for private vars? I saw something about potentially hitting reserved words.