容器
一些知识点
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| #include <iostream> using namespace std; class Base { public: Base(int a, int b, int c) { m_a = a; m_b = b; m_c = c; cout << "父类的构造函数m_a :" << m_a << endl; } public: int m_a; int m_b; int m_c; }; class Child : public Base { public: using Base::Base; Child(int a, int b, int c, double d) : Base(a, b, c) { m_d = d; cout << "子类的构造函数m_d :" << m_d << endl; } double m_d; }; int main() { Child ch1(1, 2, 3); cout << "----------------------------" << endl; Child ch(4, 5, 6, 7.7);
return 0; };
|
static和new
new一般构造一个对象,需要delate才会析构对象
static声明一个静态数据
for的新特性(c++_11)
1 2 3 4 5 6 7 8 9 10
|
for(auto prt: container){ } for_each(v.begin(), v.end(), myPrint);
|