3 #include <objc/Object.h>
9 MyWidget(void) { a = 17; }
18 @interface Foo: Object
21 @interface Bar: Foo <MyProto>
24 @interface Container: Object
25 + (MyWidget *)elementForView:(Foo *)view;
32 - (MyWidget *)widget {
37 @implementation Container
38 + (MyWidget *)elementForView:(Foo *)view
40 MyWidget *widget = nil;
41 if ([view conformsTo:@protocol(MyProto)]) {
42 widget = [(Foo <MyProto> *)view widget];
50 MyWidget *w = [Container elementForView: view];