Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Modify a prototype. The following prototype describes a class of type Square.

ID: 3902179 • Letter: 1

Question

1)

Modify a prototype. The following prototype describes a class of type Square. However, the code may have some bugs. Copy and paste this prototype, and correct any mistakes in the prototype. However, (You will then use this prototype in next 4 questions.) DO NOT change whether the overloaded operator is a member, non-member, or friend.

2)

Modify this overloaded operator definition if needed.
If the code is already perfect, write, "NO CHANGE NEEDED"

3)

Modify this overloaded operator definition if needed.
If the code is already perfect, write, "NO CHANGE NEEDED"

4)

Modify this overloaded operator definition if needed.
If the code is already perfect, write, "NO CHANGE NEEDED"

5)

Modify this overloaded operator definition if needed.
If the code is already perfect, write, "NO CHANGE NEEDED"

6)

Select all answers that apply: is there a memory bug in this code?

>Yes: shallow copy instead of deep copy

Explanation / Answer

2) NO CHANGE NEEDED

3) NO CHANGE NEEDED

4) NO CHANGE NEEDED

5)

6) No, there is no memory bug