03 2016 档案

摘要:三种继承的特点: Public:继承时保持基类中各成员的属性不变,并且基类中private成员被隐藏。派生类的成员只能访问基类中的public/protected成员,而不能访问private成员; Private:继承时基类中各成员属性均变为private,并且基类中的private成员被隐藏。派 阅读全文
posted @ 2016-03-20 15:09 没吃完的火腿肠 阅读(185) 评论(0) 推荐(0)
摘要:constexpr变量: 由于常量表达式在实际编程中比较难判断,所以c++引入constexpr来判断一个表达式是否为constexpr。被声明为constexpr的表达式一定是一个常量表达式,如果不是,编译器则会在编译阶段报错。 一般说来,如果你认定变量是常量表达式,那就把它声明为constexp 阅读全文
posted @ 2016-03-11 16:47 没吃完的火腿肠 阅读(3383) 评论(0) 推荐(0)
摘要:extern的用法:.cpp 1#include <iostream> using namespace std; extern int i; int main(int argc, char** argv) { cout << i << endl; return 0;} .cpp 2#include 阅读全文
posted @ 2016-03-10 17:52 没吃完的火腿肠 阅读(607) 评论(0) 推荐(0)