yea it didnt work for me either, you can however see this in action if you do the following :
add the Fraction.h and Complex.h files,
Set them to the ID dataValue Variable
and while dataValue is now actually a Complex Object attempt to call the SetTo:SetOver: Method for fraction and you will get the error. This teaches a couple things such as how careful you have to be when using the ID variable type and how the Exceptions work. Try it out!
#import <Foundation/Foundation.h>
#import "Fraction.h"
#include "Complex.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
id dataValue;
Fraction *f1 = [[Fraction alloc]init];
Complex *c1 = [[Complex alloc]init];
[f1 setTo:2 over:5];
[c1 setReal:10.32 setImaginary:2.5];
dataValue = f1;
dataValue = c1;
@try {
[dataValue setTo:5 over:6];
}
@catch (NSException *exception) {
NSLog(@"Caught %@%@",[exception name],[exception reason]);
}
NSLog(@"Execution Continues");
}
return 0;
}