pastebin.ch - Untitled

Subject
Untitled
Author
Unnamed
Description
No description given
Posted on
Sat, 21 Aug 2010 20:46:34 +0200
Content
#include "rtk/obj.h"
#include "stdio.h"
 
EH_DEFINE(E_Type_Error);
 
BEGIN_INTERFACE(Animal)
    void (* sound)(void);
END_INTERFACE(Animal)
 
static void cow_sound(void)
{
    puts("Moo!");
}
 
BEGIN_IMPLEMENTATION(Animal, Cow)
METHODS(Animal, Cow)
    .sound = cow_sound
END_IMPLEMENTATION(Animal, Cow)
 
int main()
{
    Cow cow;
    Animal *a;
    cow.funcs_ = &Cow_funcs;
    cow.magic_ = OBJECT_MAGIC;
    a = INTF(&cow);
    CALL0(a, sound);
    return 0;
}
 
Don't email to hereI'm now supporting the experiment spamschlucker.org too :)