Skip to content

Instantly share code, notes, and snippets.

@codyhex
Created November 20, 2017 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codyhex/eb8b29a2c90fc5638285ac8992dd3027 to your computer and use it in GitHub Desktop.
Save codyhex/eb8b29a2c90fc5638285ac8992dd3027 to your computer and use it in GitHub Desktop.
virtual_table_at_head created by Hexe - https://repl.it/@Hexe/virtualtableathead
#include <iostream>
struct A
{
int data[2];
A(int x, int y) : data{x, y} {}
virtual void f() {}
};
int main(int argc, char **argv)
{
A a(22, 33);
int *arr = (int *) &a;
std::cout << arr[2] << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment