Skip to content

Instantly share code, notes, and snippets.

@Bueddl
Created January 5, 2017 16:56
Show Gist options
  • Save Bueddl/07c9896eed01b4effdf5f1aad549eeaf to your computer and use it in GitHub Desktop.
Save Bueddl/07c9896eed01b4effdf5f1aad549eeaf to your computer and use it in GitHub Desktop.
class replacement
{
public:
void **vmt;
void setter(int a)
{
_setter(this, a);
}
int getter() const
{
return _getter(this);
}
int virtual_getter() const
{
return reinterpret_cast<getter_fn_t*>(vmt[1])(this);
}
void operator delete(void *_this)
{
void **vmt = (void**)_this;
reinterpret_cast<void(*)(void*)>(vmt[0])(_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