上QQ阅读APP看书,第一时间看更新
Test your knowledge
- Swift uses one of the following mechanisms to automatically deallocate the memory used by instances that aren't referenced anymore:
- Automatic Random Garbage Collector.
- Automatic Reference Counting.
- Automatic Instance Map Reduce.
- Swift executes an instance's deinitializer:
- Before the instance is deallocated from memory.
- After the instance is deallocated from memory.
- After the instance memory is allocated.
- A deinitializer:
- Can still access all of the instance's resources.
- Can only access the instance's methods but no properties.
- Cannot access any of the instance's resources.
- Swift allows us to define:
- Only one initializer per class.
- A main initializer and two optional secondary initializers.
- Many initializers with different arguments.
- Each time we create an instance:
- We must use argument labels.
- We can optionally use argument labels.
- We don't need to use argument labels.