OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [formal_protocol-1.m] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 307 jeremybenn
/* Contributed by Nicola Pero - Fri Mar  9 21:35:47 CET 2001 */
2
 
3
#include <stdlib.h>
4
#import "../../objc-obj-c++-shared/Object1.h"
5
 
6
/* Tests defining a protocol and a class adopting it */
7
 
8
@protocol Enabling
9
- (BOOL) isEnabled;
10
- (void) setEnabled: (BOOL)flag;
11
@end
12
 
13
@interface Feature : Object <Enabling>
14
{
15
  const char *name;
16
  BOOL isEnabled;
17
}
18
@end
19
 
20
@implementation Feature
21
- (BOOL) isEnabled
22
{
23
  return isEnabled;
24
}
25
- (void) setEnabled: (BOOL)flag
26
{
27
  isEnabled = flag;
28
}
29
@end
30
 
31
int main (void)
32
{
33
  Feature *object;
34
 
35
  object = [Feature new];
36
 
37
  [object setEnabled: YES];
38
  if (![object isEnabled])
39
    {
40
      abort ();
41
    }
42
 
43
  return 0;
44
}
45
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.