Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef enum
- {
- ShapeType_RECT,
- ShapeType_CIRCLE
- } ShapeType;
- typedef struct
- {
- ShapeType type;
- union
- {
- Rect rect;
- int radius;
- };
- Color color;
- // etc
- } Shape;
- // So, the usual way of doing dynamic types in C: Enum describing which type it is, a union of the various type-specific values, also values common to both like color.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement