Extending Class Definitions and the Interface File

You might not need to work with fractions, but these examples have shown how you can continually refine and extend a class by adding new methods. You could hand your Fraction.h interface file to someone else working with fractions, and it would be sufficient for that person to be able to write programs to deal with fractions. If that person needed to add a new method, he could do so either directly, by extending the class definition, or indirectly, by defining his own subclass and adding his own new methods. You learn how to do that in the next chapter.

Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.