Shallow vs deep copy
In struct Order { var items: [Item]; let customer: Customer }, Item is a struct and Customer is a class. After var copy = order, what happens to the original if you change copy.customer.name?
Shallow vs deep copy
In struct Order { var items: [Item]; let customer: Customer }, Item is a struct and Customer is a class. After var copy = order, what happens to the original if you change copy.customer.name?
SwiftShort answerBasics
You passed a class instance to a function, changed a property inside it, and the caller's…
#shallow-copy #deep-copy #nscopying
Memory and ARCMultiple choiceIntro
Which statement about the stack and the heap is correct?
#struct #class
Memory and ARCShort answerAdvanced
A webtoon app's Episode struct has an ImageCache property of class type. If you copy the …
#struct #class
CS fundamentals and algorithmsMultiple choiceAdvanced
You iterate over 100,000 coordinates and sum distances. Between these two versions, what'…
#struct #class