Câu hỏi phỏng vấn Objective-C
Câu hỏi

What are Objective-C Categories?

Câu trả lời

Objective-C Categories

Objective-C categories are a powerful feature that allows you to extend the functionality of existing classes without subclassing or modifying the original class. Categories provide a way to add methods to a class, even if you don't have access to the class's source code.

Here are the key points about Objective-C categories:

1. Extending Existing Classes

Categories enable you to add new methods to an existing class. This is useful when you want to extend the functionality of a class that you don't have control over, such as a class from a third-party library or a system framework.

2. Organizing Code

Categories help you organize your code by grouping related methods together. For example, you can create a category for a class that contains utility methods or convenience methods specific to your project.

3. Overriding Methods

Categories can override methods from the original class. If a category imple...

junior

junior

Gợi ý câu hỏi phỏng vấn

expert

Explain the use case when ARC won't help you to release memory (but GC will)

middle

What is the purpose of managed object context NSManagedObjectContext in Objective-C and how does it work?

middle

What's the difference between the atomic and nonatomic attributes?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào