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-4.m] - Blame information for rev 862

Go to most recent revision | 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
/* Test defining a protocol, a class adopting it in a category */
7
 
8
@protocol Evaluating
9
- (int) importance;
10
@end
11
 
12
@interface Feature : Object
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.