Fix unused warnings.
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc / execute / formal_protocol-3.m
blobc55773a668ab842d360a1b25d17be57a6ffb67ad
1 /* Contributed by Nicola Pero - Fri Mar  9 21:35:47 CET 2001 */
3 #include <stdlib.h>
4 #import "../../objc-obj-c++-shared/Object1.h"
6 /* Test defining two protocol, a class adopting both of them, 
7    and using an object of type `id <Protocol1, Protocol2>' */ 
9 @protocol Enabling
10 - (BOOL) isEnabled;
11 - (void) setEnabled: (BOOL)flag;
12 @end
14 @protocol Evaluating
15 - (int) importance;
16 @end
18 @interface Feature : Object <Enabling, Evaluating>
20   const char *name;
21   BOOL isEnabled;
23 @end
25 @implementation Feature
26 - (BOOL) isEnabled
28   return isEnabled;
30 - (void) setEnabled: (BOOL)flag
32   isEnabled = flag;
34 - (int) importance
36   return 1000;
38 @end
40 int main (void)
42   id <Enabling, Evaluating> object;
44   object = [Feature new];
46   [object setEnabled: YES];
47   if (![object isEnabled])
48     {
49       abort ();
50     }
52   if ([object importance] != 1000)
53     {
54       abort ();
55     }
57   return 0;