Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Inheritance often is used to extend a class. As an example, let’s assume that you’ve just been assigned the task of developing some classes to work with 2D graphical objects such as rectangles, circles, and triangles. For now, we’ll worry about just rectangles. Let’s go back to exercise 7 from Chapter 4, “Data Types and Expressions,” and start with the @interface section from that example:
@interface Rectangle: NSObject
{
int width;
int height;
}
@property int width, height;
-(int) area;
-(int) perimeter;
@end