CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics

Default Copy Double Free

C++ quiz · Question 30
easyRule of Three

This code compiles but crashes at runtime. What is the issue?

Code

1#include <iostream>
2using namespace std;
3 
4class IntHolder {
5public:
6 int* value;
7 IntHolder(int v) {
8 value = new int(v);
9 }
10 ~IntHolder() {
11 delete value;
12 }
13};
14 
15int main() {
16 IntHolder a(10);
17 IntHolder b = a; // copy
18 return 0;
19}