December 2013
Intermediate to advanced
132 pages
1h 58m
English
CHAPTER 19
![]()
Categories
Categories Defined
Categories are used to extend classes without using inheritance. When you use a category, you can add properties and methods to a class without declaring a super class.
To define a category, you need to add an interface and implementation. You can do this by adding new header and code files or you can add the categories right in the code file where you are working.
Category Example
As an example, let’s say that you want to take the Project class that you defined in Chapter 16 and add a constructor method that would initialize a new Project object and assign a name at the same time. You could add code like ...
Read now
Unlock full access