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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc/] [execute/] [formal_protocol-4.m] - Blame information for rev 702

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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