OSDN Git Service

New tests
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / formal_protocol-4.m
1 /* Contributed by Nicola Pero - Fri Mar  9 21:35:47 CET 2001 */
2 #include <objc/objc.h>
3 #include <objc/Object.h>
4
5 /* Test defining a protocol, a class adopting it in a category */
6
7 @protocol Evaluating
8 - (int) importance;
9 @end
10
11 @interface Feature : Object
12 @end
13
14 @implementation Feature
15 @end
16
17 @interface Feature (EvaluatingProtocol) <Evaluating>
18 @end
19
20 @implementation Feature (EvaluatingProtocol)
21 - (int) importance
22 {
23   return 1000;
24 }
25 @end
26
27 int main (void)
28 {
29   id <Evaluating> object;
30
31   object = [Feature new];
32
33   if ([object importance] != 1000)
34     {
35       abort ();
36     }
37
38   return 0;
39 }
40