📜  如何制作 c 类 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:39.155000             🧑  作者: Mango

代码示例1
typedef struct {
  ShapeClass shape;
  float width, height;
} RectangleClass;

static float rectangle_computeArea(const ShapeClass *shape)
{
  const RectangleClass *rect = (const RectangleClass *) shape;
  return rect->width * rect->height;
}