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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc/] [execute/] [formal_protocol-4.m] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* 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
 

powered by: WebSVN 2.1.0

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