- 博客(1)
- 收藏
- 关注
原创 关于由浅拷贝引起的内存重复释放问题
Part ONE.引入 以下是产生BUG的代码。 #include<iostream> using namespace std; class Int{ public: int* ptr; public: Int(int num){ ptr = new int(num); } ~Int(){ delete ptr; } }; void test(){ Int x(1), y(x); } int main()
2022-03-02 21:26:40
318
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人