Sunny, why early in the morning to give me a switch error. Exception hint: switch case in protected scope, this is completely OK when you have only one line of code in the switch's cases. If you want to write multiple lines of code in a case. This time the compiler is not calm. It will report switch case in protected scope error.
Share the switch case in protected scope exception resolution,
Switch will report the switch case in protected scope error. The compiler is telling you to stop it quickly. So you switch is developed to let me write a line of code?
Of course not, if you have this question stating that your C foundation is not solid enough. The prototype of switch:
Switch (XXX) {
Case Xxx:
{
Xxxx
}
break;
default:
break;
}
Let's continue to look at the prototype to write each case plus a {} compiler will you calm down?
Ok. You can see that there are no errors. After all, it's the basics. Silently go back to review.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Switch case in protected scope exception resolution