Debian Codegraph @

gcc/testsuite/objc/execute/formal_protocol-4.m

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