Fixed out-by-one error in previous commit.
[AROS.git] / test / oop2 / method.c
blob63af70643b80bb4cb1d787cdc2e93c999630ad88
1 /*
2 Copyright © 1997-98, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Demo of new OOP system
6 Lang: english
7 */
9 #include "types.h"
10 #include "oop.h"
12 #define CallMethod(cl, o, msg) \
13 { \
14 if (!(msg->MethodID >> NUM_METHOD_BITS)) \
15 { \
16 register struct Method *m = &(cl->MTable[msg->MethodID & METHOD_MASK]);\
17 return ( m->MethodFunc(m->m_Class, o, msg)); \
18 } \
19 return (NULL);\
22 IPTR CoerceMethodA(Class *cl, Object *o, Msg msg)
24 CallMethod(cl, o, msg);
27 IPTR DoMethodA(Object *o, Msg msg)
29 register Class *cl = OCLASS(o);
30 CallMethod(cl, o, msg);
33 IPTR DoSuperMethodA(Class *cl, Object *o, Msg msg)
35 Class *super = cl->SuperClass;
36 CallMethod(super, o, msg);