Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What are some limitations and problems you can face with categories?
Home
C Plus Plus
What are some limitations and problems you can face with categories?
+2
votes
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
What are some limitations and problems you can face with categories?
objective-c-interview-question-answer
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 19, 2022
by
DavidAnderson
Advantages
:
You can extend any class, even those, for which you do not have the source. Look, for example, into the UI extensions added by Apple to the NSString class for rendering, getting the metrics, etc.
Since you have access to all instance variables, categories provide you with a nice way to structure your code across compilation units using logical grouping instead of the “it must all be in one phyiscal place” approach taken, for example, by Java.
Disadvantages
:
You cannot safely override methods already defined by the class itself or another category.
Related questions
+2
votes
Q: When would you use Categories over Inheritance and vice versa?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: What's the difference between using a delegate and notification?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: What's the difference between the atomic and nonatomic attributes?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: What is the purpose of managed object context NSManagedObjectContext in Objective-C and how does it work?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: What is the bug in this code and what is its consequence?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: What is Key-Value-Coding and Key-Value-Observing in Objective-C?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: When to use NSArray vs NSSet?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+2
votes
Q: What mechanisms does iOS provide to support multi-threading?
asked
Jan 19, 2022
in
C Plus Plus
by
DavidAnderson
objective-c-interview-question-answer
+1
vote
Q: What are some issues you can face with Azure Databricks?
asked
Nov 19, 2022
in
Azure Databricks
by
SakshiSharma
azure-databricks
issues-azure
0
votes
Q: What are the problems that a business analyst may face?
asked
Dec 8, 2021
in
Other
by
DavidAnderson
business-analyst-interview-questions
...