Day-2 Flashcards

1
Q

Shallow copy vs. Deep Copy (Copy conforms to a copy Protocol)

A
  • [ ] Shallow copy - copies the reference not the data themselves
  • [ ] Deep copy - copy all the members of the object into a new object
    # it conforms to copyWithZone:
//Deep copy Example
- (id)copyWithZone:(NSZone *)zone
{
    Person *person = [[Person alloc]init];
    person.name = self.name;
    person.email = self.email;
return person; }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly