摘要: 1 问题引入 问题:类中是否可以定义 const 成员? 示例:下面的类定义是否合法?如果合法,ci 的值是什么,存储在哪里? Demo #include <stdio.h> class Test { private: const int ci; public: int getCI() { retu 阅读全文
posted @ 2020-09-22 23:38 nxgy 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1 对象的初始化 问题:对象中成员变量的初始值是多少? Demo #include <stdio.h> class Test { private: int i; int j; public: int getI() { return i; } int getJ() { return j; } }; T 阅读全文
posted @ 2020-09-22 22:04 nxgy 阅读(108) 评论(0) 推荐(0) 编辑