感觉得学习一下优秀的代码框架了。我尝试了很多,但现在想不到好的办法了。

This commit is contained in:
建峰 2024-09-01 18:48:20 +08:00
parent 42d305eabe
commit b88995b0bd

View File

@ -11,11 +11,8 @@ double rect_area(void *self, void *parent)
void rect_draw(void *self, void *parent)
{
// struct _rect *pthis = (struct _rect *)parent;
// pthis->shape->vtb.draw(self, NULL);
struct _rect *pthis = container_of(parent, struct _rect, self);
pthis->shape->vtb.draw(pthis, NULL);
struct _rect *pthis = (struct _rect *)parent;
pthis->shape->vtb.draw(self, NULL);
}
double _rect_area(void *self, void *parent)