Skip to content

Instantly share code, notes, and snippets.

@pasberth
Created January 9, 2014 14:35
Show Gist options
  • Select an option

  • Save pasberth/8335035 to your computer and use it in GitHub Desktop.

Select an option

Save pasberth/8335035 to your computer and use it in GitHub Desktop.
進捗です
#include <iostream>
typedef void (*f_t)();
class Base {
public:
virtual void f();
};
struct Derivied : public Base {
public:
void f();
};
void Base::f()
{
std::cout << "hello, I am base" << std::endl;
}
void Derivied::f()
{
std::cout << "hello, I am derived" << std::endl;
}
int main(int argc, char const *argv[])
{
Derivied *x = new Derivied;
void (***f)() = reinterpret_cast<f_t **>(x);
(**f)();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment