URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
|
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */
|
#include <objc/objc.h>
|
#include <objc/objc.h>
|
#include <objc/Object.h>
|
#include <objc/Object.h>
|
|
|
/* Test defining a protocol, a class adopting it in a category */
|
/* Test defining a protocol, a class adopting it in a category */
|
|
|
@protocol Evaluating
|
@protocol Evaluating
|
- (int) importance;
|
- (int) importance;
|
@end
|
@end
|
|
|
@interface Feature : Object
|
@interface Feature : Object
|
@end
|
@end
|
|
|
@implementation Feature
|
@implementation Feature
|
@end
|
@end
|
|
|
@interface Feature (EvaluatingProtocol) <Evaluating>
|
@interface Feature (EvaluatingProtocol) <Evaluating>
|
@end
|
@end
|
|
|
@implementation Feature (EvaluatingProtocol)
|
@implementation Feature (EvaluatingProtocol)
|
- (int) importance
|
- (int) importance
|
{
|
{
|
return 1000;
|
return 1000;
|
}
|
}
|
@end
|
@end
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
id <Evaluating> object;
|
id <Evaluating> object;
|
|
|
object = [Feature new];
|
object = [Feature new];
|
|
|
if ([object importance] != 1000)
|
if ([object importance] != 1000)
|
{
|
{
|
abort ();
|
abort ();
|
}
|
}
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.