void rect_lenght(void* me);
void rect_area(void* me); //private olması için burda tanımladık
//constructor
void rect_ctor(rect* me,uint16_t x, uint16_t y, uint16_t en, uint16_t boy) {
//burada rect'a ait metotlar vtbl'ye verildi.
struct Vtable vtbl = { &rect_area, &rect_lenght };
shape_ctor(&me->super, x, y);
me->super.vptr = &vtbl; //override vptr. area ve lenght metotları rect'e ait metotlara işaret ediyor.
me->en = en;
me->boy = boy;
}
void rect_lenght(void* me) {
rect* me_ = (rect*)me; //downcast işlemi
printf("rectangle lenght: %d\n",(me_->en + me_->boy) * 2);
}
void rect_area(void* me) {
rect* me_ = (rect*)me; //downcast işlemi
printf("rectangle area: %d\n", (me_->en)*(me_->boy));
}