#include <stdlib.h>
#include <stdio.h>

typedef struct{
	void(*Repaint)(void *);
	int X, Y;
}  Component;

void *new_Component(int x, int y){
	Component *this = malloc(sizeof(Component));
	this->X = x;
	this->Y = y;
	return this;
}
void delete_Component(Component *this){
	free(this);
}

typedef struct{
	Component *Base;
	const char *Text;
} Label;
void Label_Repaint(void *voidthis){
	Label *this = voidthis;
	Component *base = this->Base;
	printf("Label \"%s\" at {%d, %d}", this->Text, base->X, base->Y);
}
void *new_Label(int x, int y, const char *text){
	Label *this = malloc(sizeof(Label));
	this->Base = new_Component(x, y);
	this->Base->Repaint = Label_Repaint;
	this->Text = text;
	return this;
}
void delete_Label(Label *this){
	delete_Component(this->Base);
	free(this);
}

int main(void){
	Label *l = new_Label(1, 2, "Patrick Bateman");
	l->Base->Repaint(l);
	delete_Label(l);
	return 0;
}
