CJCoding With Joseph
15free / daySign inCreate account

Rule of Three

Implement the Rule of Three for a class NumberHolder with int* value.

Requirements:
1. Constructor allocates memory
2. Destructor frees memory
3. Copy constructor deep copies
4. Copy assignment operator deep copies and handles self-assignment
5. getValue() and setValue(int)

Do NOT write a main function.

Expected Output:

5

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.