December 2013
Beginner
576 pages
16h 4m
English
Next, it’s time to take a look at the Calculator class. The concept is similar to the class of the same name we developed earlier in this book. However, in this case, our calculator must know how to deal with fractions. Here are our new Calculator class interface and implementation files.
Program 21.2 Calculator.h Interface File
#import <UIKit/UIKit.h>#import "Fraction.h"@interface Calculator : NSObject@property (strong, nonatomic) Fraction *operand1;@property (strong, nonatomic) Fraction *operand2;@property (strong, nonatomic) Fraction *accumulator;-(Fraction *) performOperation: (char) op;-(void) clear;@end
Program 21.2 Calculator.m Implementation File
Read now
Unlock full access