C++ ã® const ã«ã¯ã2ã¤ã®æå³ãããã¾ãã å®æ°ã¨ããæå³ã§ã® const ã¨ã ã¡ã½ãããå¼ãã§ããªãã¸ã§ã¯ãã®ç¶æ ãå¤ç°ãã¾ãããã¨ããconstã§ãã åè ã¯ããããªæãã®æ¸ãæãä¸å¯ã«ä½¿ãã¾ãã const int a = 10; printf("%d\r\n" , a ) ; //èªã¿è¾¼ã¿ã¯OK printf好ã //æ¸ãè¾¼ã¿ã¯ä¸å¯ const ãªã®ã§æ¸ãæããããªãã a = 20; å¾è ã®ã¡ã½ãããèªãã§ããªãã¸ã§ã¯ãã®ç¶æ ãå¤ç°ãã¾ããããªconstã¯ãããªé¢¨ã«ã¡ã½ããã®å¾ãã«ã¤ãã¾ãã class myClass { private: int a; public: // âãã void abc() const { //ãã®ä¸ã§ã¯ããªãã¸ã§ã¯ãã¡ã³ãå¤æ°ã¸ã®ä»£å ¥ãç¦æ¢ã«ãªãã¾ã. printf("%d\r\n" , this->a ) ; //èªã¿è¾¼ã¿ã¯OK /
{{#tags}}- {{label}}
{{/tags}}