Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

human.h

By: a guest on May 20th, 2012  |  syntax: C  |  size: 0.94 KB  |  views: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*-
  2.  * Copyright (c) 2012 valsorym <valsorym.e@gmail.com>.
  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. /* NEW TYPES */
  14. /* ************************************************************************* */
  15.  
  16. #ifndef HUMAN_H
  17. #define HUMAN_H
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22.  
  23. /* Сlass of persons. */
  24. struct w_human {
  25.     /* Private: */
  26.     int age;
  27.     char *name;
  28.  
  29.     /* Public: */
  30.     int (*setage)(struct w_human *, int );
  31.     int (*getage)(struct w_human *);
  32.    
  33.     char *(*setname)(struct w_human *, char *);
  34.     char *(*getname)(struct w_human *);
  35. };
  36.  
  37. /* Class initializer. */
  38. extern const struct w_human_initializer {
  39.     struct w_human *(*create)(int , char *);
  40.     void (*destroy)(struct w_human *);
  41. } w_human;
  42.  
  43. #endif
  44.  
  45. /* The End. */
clone this paste RAW Paste Data