C++11?ж???(class)??????????
???????????? ???????[ 2015/9/9 14:26:36 ] ??????????????????? .NET
??????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;
????// ...
????};
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????