1 #include <stdio.h> 2 #include <stdlib.h> 3 4 /* this file is a small C++ program with a global object. 5 it is used to test problems related to constructors/destructors 6 in C++ programs, which are called resp. before and after 7 main() (it is enoying for me, because I need to detected 8 the REAL end of the program. */ 9 10 class Yannick 11 { 12 int a, b, c; 13 char *t; 14 public: 15 Yannick(void); 16 ~Yannick(); 17 } global_object; 18 19 int i = 0; 20 21 Yannick::Yannick(void) 22 { 23 printf("cnst\n"); 24 a = 0; 25 b = 1; 26 c = 2; 27 28 t = (char *) malloc(100); 29 } 30 31 Yannick::~Yannick(void) 32 { 33 free(t); 34 printf("~\n"); 35 } 36 37 int main(void) 38 { 39 printf("hello world!\n"); 40 return 0; 41 }