I would suggest something along the lines of:
Code:
enum BookType {
novel,
digest,
magazine
};
// ...
void B::details(int price, BookType bookType)
{
switch (bookType)
{
case novel:
// do something
break;
case digest:
// do something
break;
case magazine:
// do something
break;
}
}
Then you would use it as:
Code:
B *b;
b->details(123, novel);
However, it may be the case that instead of using an enum, you might want a class hierarchy instead, in which case the B object would have a Book (smart) pointer, and forward the work of its details() member function to the appropriate virtual function of the Novel, Digest, Magazine, etc, child class of Book. This design would be more extensible then using a switch based on an enum, but may also be overkill.