home *** CD-ROM | disk | FTP | other *** search
- #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
-