-(id) init {
[self dealloc];
@throw [NSException exceptionWithName:@"BadInitCall"
reason:@"The class must initialized with initWithEntryDate"
userInfo:nil];
return nil;
}
-(id) initWithEntryDate:(NSCalendarDate*)newEntryDate {
self = [super init];
if (self == nil) {
return nil;
}
[self setEntryDate:newEntryDate];
[self prepareRandomNumber];
return self;
}
#import <Foundation/Foundation.h>
#import "LotteryEntry.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
LotteryEntry* lotter;
@try {
lotter = [[LotteryEntry alloc] init];
} @catch (NSException * e) {
NSLog(@"%@", [e reason]);
} @finally {
}
[lotter release];
lotter = [[LotteryEntry alloc] initWithEntryDate:[NSCalendarDate calendarDate]];
[lotter release];
[pool drain];
return 0;
}