Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • One thing I don't understand is why you have Capitalized the name CandleRackStatus. I thought an enum was just a variable and nothing like a class or struct. I think it's confusing to treat it like a class (with naming conventions) ... Commented Mar 20, 2016 at 9:49
  • last question, when I actually want to change the status of the CandleRack, do I do _candleRackStatus = candlesOn ? Commented Mar 20, 2016 at 10:34
  • Re: Capitalized, that's a matter of taste and what school of programming you come from. I recommend treating enums like types, because they are. And in most C++ styles types get a capitalized name. See google.github.io/styleguide/cppguide.html#Enumerator_Names for reference, also a good read as a whole. Commented Mar 20, 2016 at 11:36
  • Re: changing the status, the identifier candlesOn is defined within the type declaration of the enum. So in order to access it you would qualify it with the type name: CandleRackStatus::candlesOn. That's called static access and the :: operator works on all type properties that are public and static (see stackoverflow.com/questions/10090949/…). So you would change the status using _candleRackStatus = CandleRackStatus::candlesOn. Commented Mar 20, 2016 at 11:46
  • We've discussed simplification of names before, so if these expressions are too lengthy or confusing, just choose shorter names for types and variables. Commented Mar 20, 2016 at 11:49