c来实现虚函数

#include <stdio.h> typedef struct { void (*draw)(void*); //虚函数 void (*rotate)(void*); }vtable; typedef struct { vtable *vptr; //虚表指针 }Shape; typedef struct { vtable *vptr; int x,y
相关文章
相关标签/搜索