Artificial intelligent assistant

メモリの二重解放について c++ 2new delete ) B.h class B { public: float num; float vt; public: void clear(){ num = vt = 0; } } A.h '#'pragma once '#'include "B.h" class A { private: B* value; public: B* cul(float b); B* cul2(float c); }; A.cpp '#'include "A.h" A::A() { value = new B; } A::~A() { delete value; } B* A::cul(float b) { // value->num = b * 2; value->vt= b * 3; return value; } B* A::cul2(float c) { // value->num = c * 5; value->vt = c / 3; return value; } exe Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse) delete delete new delete c++

delete

* * *




B A::cul(float b){
return { b * 2, b * 3 };

//
B b;
b.num = b * 2;
b.vt = b * 3;
return b;
}


`B` `new``delete`

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f1803759607a4859d2689812f76fc02b