Created
January 5, 2017 16:56
-
-
Save Bueddl/07c9896eed01b4effdf5f1aad549eeaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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