摘要: 代码1 #include <iostream> #include <thread> using namespace std; class A { public: A() { cout << "A()" << endl; } ~A() { cout << "~A()" << endl; } void 阅读全文
posted @ 2022-12-02 16:40 Hello_Bugs 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 代码1 int main(){ //裸指针,手动开辟,需要自己释放,如果忘记了或者因为 //程序逻辑导致p没有释放,那么就会导致内存泄漏 int *p=new int(10); if(***){ retur -1; } delete p; return 0; } 有没有什么办法帮我们管理指针,确保资 阅读全文
posted @ 2022-12-02 15:19 Hello_Bugs 阅读(87) 评论(0) 推荐(0) 编辑