December 2012
Beginner
552 pages
12h 58m
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, *operand2, *accumulator;-(Fraction *) performOperation: (char) op;-(void) clear;@end
Program 21.2. Calculator.m Implementation File
#import "Calculator.h"@implementation Calculator@synthesize operand1, operand2, accumulator;-(id) init{ self = [super ...
Read now
Unlock full access