Timeline for How do I correctly use enum within a class?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 20, 2016 at 9:40 | comment | added | Rob Hilken | Hmm, I find descriptive names more readable and other elements of my sketch will also have a status (even of this object - music status, animation status etc) so I think it's important for me not to rename. I'm also unsure of where status_t comes from, what is the _t ? | |
| Mar 19, 2016 at 12:35 | comment | added | sekdiy |
status is an alternative naming to your candleRackStatus. Simpler names can increase readability. Since you only pass one parameter, you don't really need to qualify it in more detail than neccessary, so it's probably a good idea to simplify. :) I've updated my answer to explain the use of the enum type and a default parameter value.
|
|
| Mar 19, 2016 at 10:46 | history | edited | Mikael Patel | CC BY-SA 3.0 |
added 90 characters in body
|
| Mar 19, 2016 at 10:36 | comment | added | Rob Hilken |
In this example where is status coming from? status_t status = inactive
|
|
| Mar 19, 2016 at 10:20 | comment | added | Rob Hilken | But also thanks to Mikael for this post too, it also helps my understanding of how to use enums. | |
| Mar 19, 2016 at 10:19 | comment | added | Rob Hilken | Yes It does a bit. If you could add some of these suggestions to your post I think that would make it a great answer. Especially as this shows how I could use the enum as a public member and not outside of the class - which in my mind, makes it more understandable. | |
| Mar 18, 2016 at 22:19 | comment | added | sekdiy | It seems this answer compiles the gist of my answer into a code-only post (see e.g. meta.stackexchange.com/questions/148272/…) | |
| Mar 18, 2016 at 19:53 | history | answered | Mikael Patel | CC BY-SA 3.0 |