08 2024 档案
摘要:class Dog { public: class Animal { public: Animal(Dog* dog) { m_Dog = dog; m_Age = 1; m_Name = dog->m_Info; // 可以访问宿主类对象 } string m_Name; int getAge()
阅读全文
摘要:class Dog { public: Dog() { m_Name = "小狗狗"; m_Info = "田园狗"; m_Test = "测试"; } void showTest() { cout << "Test:" << m_Test << endl; } void showGood() {
阅读全文
摘要:#include <string> #include <mutex> #include <iostream> using namespace std; namespace { //std::mutex m; std::recursive_mutex m; // 可递归 class Test { pu
阅读全文
摘要:#include <string> #include <iostream> using namespace std; namespace { class Animal { public: Animal() { cout << "基类调用虚函数…" << endl; cout << GetInfo()
阅读全文
摘要:#include <string> #include <iostream> using namespace std; namespace { class Animal { public: string GetInfo() { return "我是动物"; } }; class Dog :public
阅读全文
摘要:C++ #include <functional> #include <iostream> #include <vector> #include <memory> #include <set> #include <map> #include <string> using namespace std;
阅读全文
摘要:#include <iostream> #include <string> #include <memory> using namespace std; namespace { class B; class A { public: std::shared_ptr<B> pb; }; class B
阅读全文
摘要:ui.tabObj->insertTab(0, widgetObj1, tr("tabName0")); ui.tabObj->insertTab(1, widgetObj1, tr("tabName1")); ui.tabObj->insertTab(2, widgetObj2, tr("tabN
阅读全文