| 1 |
#include <stdio.h> |
| 2 |
#include <stdlib.h> |
| 3 |
|
| 4 |
#include "hello_world.h" |
| 5 |
|
| 6 |
static int hello_world_id = 0; |
| 7 |
|
| 8 |
hello_world* hello_world_new() { |
| 9 |
hello_world* obj = (hello_world*)(malloc(sizeof(hello_world))); |
| 10 |
obj->id = (hello_world_id++); |
| 11 |
return obj; |
| 12 |
} |
| 13 |
|
| 14 |
void hello_world_say(hello_world* hello_obj) { |
| 15 |
printf("Hello, world! My id is %d\n", hello_obj->id); |
| 16 |
} |
| 17 |
|
| 18 |
void hello_world_destroy(hello_world* hello_obj) { |
| 19 |
printf("Goodbye, world! My id is %d\n", hello_obj->id); |
| 20 |
free(hello_obj); |
| 21 |
} |
| 22 |
|