프로그래밍언어/C++
enum의 주의점
컴퓨터과학
2020. 9. 2. 21:54
enum spectrum{red, orange, yellow, green, blue , violet, indigo, ultrviolet{
spectrum band;
band=blue; // 맞음
band =2000; // 틀림
band=orange;
++band; //틀림 될수도 있지만 일반적으로 위험하며 이식성을 높이기위해 사용해선안된다.
band=orange+red;//틀림
int color =blue; //맞다
band=3;//틀리다
color=3+red //맞다
band=spectrum(3); // 맞다
band=spectrum(40003);//미확정