Facebook
From Innocent Ibis, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 366
  1. typedef enum {
  2.  NORTH, SOUTH, EAST, WEST
  3. } Direction;
  4. typedef struct {
  5.  char *description;
  6.  int (*init)(void *self);
  7.  void (*describe)(void *self);
  8.  void (*destroy)(void *self);
  9.  void *(*move)(void *self, Direction direction);
  10.  int (*attack)(void *self, int damage);
  11. } Object;
  12. int Object_init(void *self);
  13. void Object_destroy(void *self);
  14. void Object_describe(void *self);
  15. void *Object_move(void *self, Direction direction);
  16. int Object_attack(void *self, int damage);
  17. void *Object_new(size_t size, Object proto, char *description);
  18. #define NEW(T, N) Object_new(sizeof(T), T##Proto, N)
  19. #define _(N) proto.N
  20.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Diminutive Echidna text 5 Years ago.