← Back to Question List
C++ Quiz #30
Default Copy Double Free
This code compiles but crashes at runtime. What is the issue?
📄 Code
1#include <iostream>2using namespace std;34class IntHolder {5public:6 int* value;7 IntHolder(int v) {8 value = new int(v);9 }10 ~IntHolder() {11 delete value;12 }13};1415int main() {16 IntHolder a(10);17 IntHolder b = a; // copy18 return 0;19}