ããã©ã«ãã£ã¦ï¼
ãããã¡ãã¡ãªã³ã¼ãã®ãã¡ãªçç±ãæ¸ãã³ã¼ãã¼ã
char const* getNameFromID(int id) { switch (id) { case ID_FOO: return "FOO"; case ID_BAA: return "BAA"; default: return "TEST"; } }
ID_FOOãåãåã£ãå ´åã«"FOO"ãID_BAAãåãåã£ãå ´åã«"BAA"ãè¿ãã¨ããé¢æ°ãã¨ããã¨ããã¾ã§ã¯è¯ã(å½¹ã«ç«ã¤ãã©ããã¯å¥ã¨ãã¦)ãåé¡ã¯defaultæã«è¿ã"TEST"ã®åå¨ã ã
ã¾ããæ£ããåä½ãã確èªããªããã°ãªããªãããã®ã½ã¼ã¹ã³ã¼ãããéç®ããã¨æ¬¡ã®ä¸ã¤ãããã¯ããããã ããããã¦ãã©ãããæ£ããåä½ããªã®ã ãããã
- ID_FOO,ID_BAA以å¤ã®ã¨ãã¯"TEST"ãè¿ãã
- ID_FOO, ID_BAA以å¤ã®ã¨ãã¯æªå®ç¾©ã
- ID_TESTã®ã¨ãã¯"TEST"ãè¿ããID_FOO, ID_BAA, ID_TEST以å¤ã®ã¨ãã¯æªå®ç¾©ã