Intermediate Swift
Q48 / 100

What is the difference between value types and reference types regarding mutation?

Correct! Well done.

Incorrect.

The correct answer is B) Mutating a value type creates a copy; mutating a reference type affects all references to the same object

B

Correct Answer

Mutating a value type creates a copy; mutating a reference type affects all references to the same object

Explanation

With value types (struct/enum), each copy is independent. With reference types (class), all variables pointing to the same object see the mutation.

Progress
48/100