fork download
  1. #include <stdio.h>
  2.  
  3. typedef struct {
  4. void (*write)();
  5. const char*s;
  6. } class;
  7.  
  8. void write(class*this,const char*s){puts(this->s);puts(s);}
  9.  
  10. int main()
  11. {
  12. class objekt={write,"privat"}; /* "Klassen"-Instanziierung */
  13.  
  14. objekt.write(&objekt,"public"); /* OOP */
  15.  
  16. return 0;
  17. }
  18.  
  19.  
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
privat
public