December 2013
Beginner
576 pages
16h 4m
English
Program 9.1 shows the interface file for a class called Complex, which is used to represent complex numbers in a program.
Program 9.1 Interface File Complex.h
// Interface file for Complex class#import <Foundation/Foundation.h>@interface Complex: NSObject@property double real, imaginary;-(void) print;-(void) setReal: (double) a andImaginary: (double) b;-(Complex *) add: (Complex *) f;@end
You should have completed the implementation section for this class in exercises 5 and 6 from Chapter 7, “More on Classes.” We added an additional setReal:andImaginary: method to enable you to set both the real and imaginary parts of your number with a single message and also synthesized ...
Read now
Unlock full access