??????C++0x?У??????????????????????????????????????????
????class X {
????int a;
????public:
????X(int x) { if (0<x && x<=max) a=x; else throw bad_X(x); }
????// ??????X()???ù?????X(int x)
????X() :X{42} { }
????// ??????X(string s)???ù?????X(int x)
????X(string s) :X{lexical_cast<int>(s)} { }
????// …
????};
??????е?????? Inheriting constructors
????C++11???????????????????????
???????????????????????????????????????????????????????????
?????????????D1 d(6);?????????????????????????????????л??????????????D1(int)??
??????????????????????????????????????????????????????????????????????г????????
?????????ó?????б???????
????struct B1 {
????B1(int) { }
????};
????struct D1 : B1 {
????using B1::B1; // ?????????????D1(int)
????// ??????????????x??????????????
????int  x{0};
????};
????void test()
????{
????D1 d(6);    // d.x?????0
????}
?????????????????? Non-static data member initializers
??????C++98????????static const??????????????????????????????????????????????????????Щ???????????????????????????????С?
????class X {
????static const int m1 = 7;   // ???
????const int m2 = 7;    // ??????static
????static int m3 = 7;              // ??????const
????static const string m5 = “odd”; //??????????
????};
????C++11????????????????????non-static??????????????????????????????????????г??????????????????????????????????????????????????????????????????д??
????class A {
????public:
????int a = 7;
????};
?????????????ó?????б??
????class A {
????public:
????int a;
????A() : a(7) {}
????};
???????????????????????????????Щ?????????????ж?????????????У??????????????
class A {
public:
A(): a(7)?? b(5)?? hash_algorithm(“MD5″)??
s(“Constructor run”) {}
A(int a_val) :
a(a_val)?? b(5)?? hash_algorithm(“MD5″)??
s(“Constructor run”)
{}
A(D d) : a(7)?? b(g(d))??
hash_algorithm(“MD5″)?? s(“Constructor run”)
{}
int a?? b;
private:
// ???????????????????A?????????
HashingFunction hash_algorithm;
std::string s;  // ???????????????????????????????????????
};
????????????
????class A {
????public:
????A() {}
????A(int a_val) : a(a_val) {}
????A(D d) : b(g(d)) {}
????int a = 7;
????int b = 5;
????private:
????//???????????????????A?????????
????HashingFunction hash_algorithm{“MD5″};
????//???????????????????????????????????????
????std::string s{“Constructor run”};
????????????
??????????????????
??????C++98?У???????????????????????????????????????????????????????????????
??????C++11?У?????????????move???壬???????????????2???????????????????????? move assignment ??????????????? move constructor ????
????BS???飬?????????????????? 5 ??????????????е??κ?????????????????? 4 ????????????????????????????????????????????????????
????????????????????? ???? ?? ???? ?? =default ?? ???? =delete ?????????????????е????????????????????????????????move??????
????????????????????? ???? ?? ???? ?? =default ?? ???? =delete ?????????????????е???????????????????????????????е?????????????????????t?????????????????????????????????????????????
??????????????????? 5 ?????????е??κ????????????????????????????? 5 ?????????????磺
????template<class T>
????class Handle {
????T* p;
????public:
????Handle(T* pp) : p{pp} {}
????// ??????幹?????? ????????????????????
????~Handle() { delete p; }
????Handle(Handle&& h) :p{h.p}
????{ h.p=nullptr; }; // transfer ownership
????Handle& operator=(Handle&& h)
????{ delete p; p=h.p; h.p=nullptr; } // ?????????
????Handle(const Handle&) = delete;  // ?????????????
????Handle& operator=(const Handle&) = delete;
????// ...
????};