In a switch case does the quantity have to be an int?
Printable View
In a switch case does the quantity have to be an int?
It has to be an integral type or an object with a one step conversion to integral type. That doesn't necessarily mean int though, it could be char or long or an enumeration or a class with operator int overloaded. And so on and so forth. :)
Do you have to do something special to get it to work with a char?
no. post some code.Quote:
Originally Posted by DeepFyre
Code:switch( somechar ) {
case 'a': ...
case 'b': ---
}