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

junior

What is a protocol, and how do you define your own and when is it used?

senior

What is the difference between ARC (automatic reference counting) and GC (garbage collection)?

junior

Explain types of protocol in Objective-C

Bình luận

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

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