This is Square.m in view mode; [Download] [Up]
#import "Square.h" @implementation Square // override method to print the width and height // as well as the area -(float)calcArea { // use self to refer to the same object // that received the calcArea method [self printHeight]; [self printWidth]; // use super to access the superclass' // implementation return [super calcArea]; } -printHeight { printf("The height is %.2f\n", height); return self; } -printWidth { printf("The width is %.2f\n", width); return self; } -free { return [super free]; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.