#include <stdio.h>
struct class_t;
typedef struct class_t class_t;;
typedef struct data {
int i;
class_t * class;
} data;
struct class_t
{
int (* print)(const char *, ...);
};
class_t funclass = {printf};
int main(void)
{
data a;
a.class = &funclass;
a.i = 10;
a.class->print("%d", a.i);
getchar();
return 0;
}
struct class_t;
typedef struct class_t class_t;;
typedef struct data {
int i;
class_t * class;
} data;
struct class_t
{
int (* print)(const char *, ...);
};
class_t funclass = {printf};
int main(void)
{
data a;
a.class = &funclass;
a.i = 10;
a.class->print("%d", a.i);
getchar();
return 0;
}
—>〉Sun〈<—