Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A{
- public:
- virtual void foo(){
- cout << "Hallo A\n";
- }
- virtual void bar(){
- cout << "Bar A\n";
- }
- };
- class B : A{
- public:
- virtual void foo(){
- cout << "Hallo B\n";
- }
- };
- typedef void (*foo_ptr)();
- int main() {
- // your code goes here
- B a;
- //a.foo();
- void** ref = *(void***)&a;//vtable
- ((foo_ptr)ref[1])();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment