Some Notes about Categories
A category can override another method in the class, but this is considered poor programming practice. For one thing, after you override a method, you can no longer access the original method. Therefore, you must be careful to duplicate all the functionality of the overridden method in your replacement. If you do need to override a method, subclassing might be the right choice. If you override a method in a subclass, you can still reference the parent’s method by sending a message to super. So, you don’t have to understand all the intricacies of the method you are overriding; you can just invoke the parent’s method and add your own functionality to the subclass’s method.
You can have as many categories as you like, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access