Greetings. I am trying to get a handle on using enums. In particular I would like to set something up whereby a user could input data that would be used in a constructor call to create an instance of class Book. The code in main is similar to the way I would do it for built-in types, but as is it won't compile.
Anyways I could use a little guidance here. My sample code is stripped down to the bare minimum, I hope there is enough left to indicate what I have in mind.
The standard input output library knows about standard types like int and library-defined types like std::string
genre is a user-defined scoped enum; there is no implicit conversion between genre and any integral type. We need to provide user-defined input output facilities for genre
Start with something simple - accept an integer from the user (0 for genre::fiction, 1 for genre::nonfiction etc.)
(Sometime later, if required, refine it to accept strings.)
>Start with something simple - accept an integer from the user (0 for >genre::fiction, 1 for genre::nonfiction etc.)
>(Sometime later, if required, refine it to accept strings.)