| 1 |
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
#include <objc/Protocol.h> |
| 5 |
#include "../../objc-obj-c++-shared/TestsuiteObject.m" |
| 6 |
|
| 7 |
/* Test defining two protocols, one incorporating the other one. */ |
| 8 |
|
| 9 |
@protocol Configuring |
| 10 |
- (void) configure; |
| 11 |
@end |
| 12 |
|
| 13 |
@protocol Processing <Configuring> |
| 14 |
- (void) process; |
| 15 |
@end |
| 16 |
|
| 17 |
/* A class adopting the protocol */ |
| 18 |
@interface Test : TestsuiteObject <Processing> |
| 19 |
{ |
| 20 |
BOOL didConfigure; |
| 21 |
BOOL didProcess; |
| 22 |
} |
| 23 |
@end |
| 24 |
|
| 25 |
@implementation Test |
| 26 |
- (void) configure |
| 27 |
{ |
| 28 |
didConfigure = YES; |
| 29 |
} |
| 30 |
- (void) process |
| 31 |
{ |
| 32 |
didProcess = YES; |
| 33 |
} |
| 34 |
@end |
| 35 |
|
| 36 |
int main (void) |
| 37 |
{ |
| 38 |
id <Processing> object = [Test new]; |
| 39 |
|
| 40 |
[object configure]; |
| 41 |
[object process]; |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |
| 45 |
|