Skip to content

Instantly share code, notes, and snippets.

@Bueddl
Created January 5, 2017 16:55
Show Gist options
  • Save Bueddl/063a1c8c6755d630a85f1a558bfbc321 to your computer and use it in GitHub Desktop.
Save Bueddl/063a1c8c6755d630a85f1a558bfbc321 to your computer and use it in GitHub Desktop.
class replacement
{
public:
struct vmt_t
{
void (*dtor)(void* _this);
getter_fn_t *virtual_getter;
} *vmt;
void setter(int a)
{
_setter(this, a);
}
int getter() const
{
return _getter(this);
}
int virtual_getter() const
{
return vmt->virtual_getter(this);
}
void operator delete(void *_this)
{
vmt_t *vmt = (vmt_t*)_this;
vmt->dtor(_this);
::operator delete(_this);
}
static setter_fn_t *_setter;
static getter_fn_t *_getter;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment