[C++再学习系列] 类常量
摘要:
C++ 标准允许在类的定义中定义静态整数常量,但其他类型的类常量则需要单独的定义或将常量封装在函数中 。举例:// File widget.hclass Widget {static const int defaultWidth = 400; // value provided in declarationstatic const double defaultPercent; // value provided in definitionstatic const char* Name() {return "Widget"; }};// File widget.cppcons 阅读全文
posted @ 2012-11-13 19:08 sslshopper 阅读(152) 评论(0) 推荐(0)
浙公网安备 33010602011771号