Advertisement
Guest User

human.h

a guest
May 21st, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. /*-
  2.  * Copyright (c) 2012 valsorym <[email protected]>.
  3.  * All rights reserved.
  4.  *
  5.  * Discussion on the forums.freebsd.org.
  6.  *  url: http://forums.freebsd.org/showthread.php?p=177208
  7.  */
  8.  
  9. /*
  10.  * Very simple class, for example OOD in ANSI C.
  11.  */
  12.  
  13. #ifndef HUMAN_H
  14. #define HUMAN_H
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19.  
  20. /* Сlass of persons. */
  21. struct w_human {
  22.     int age;
  23.     char *name;
  24. };
  25.  
  26. /* Class initializer. */
  27. extern const struct w_human_vtable {
  28.     struct w_human *(*create)(int , char *);
  29.     void (*destroy)(struct w_human *);
  30.    
  31.     int (*setage)(struct w_human *, int );
  32.     int (*getage)(struct w_human *);
  33.    
  34.     char *(*setname)(struct w_human *, char *);
  35.     char *(*getname)(struct w_human *);
  36. } w_human;
  37.  
  38. #endif
  39.  
  40. /* The End. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement