Skip to content

Instantly share code, notes, and snippets.

@simonask
Created August 9, 2009 21:38
Show Gist options
  • Save simonask/164910 to your computer and use it in GitHub Desktop.
Save simonask/164910 to your computer and use it in GitHub Desktop.
static int n = 0;
class A {
public:
virtual void foo() {
++n;
}
};
class B : public A {
public:
void foo() {
++n;
return;
}
};
class C : public B {
public:
void foo() {
++n;
}
};
class D : public C {
public:
void foo() {
++n;
}
};
int main (int argc, char const *argv[])
{
for (int i = 0; i < 10000000; ++i)
{
A a;
a.foo();
B b;
b.foo();
C c;
c.foo();
D d;
d.foo();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment