ultimatepp/uppdev/Vtbl/vtbl.cpp
cxl 351994a6cc Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

30 lines
379 B
C++

#include <stdio.h>
struct A
{
virtual void afn() { puts("A::afn"); }
// A must have vtbl to make this crash
};
struct B
{
virtual void bfn() { puts("B::bfn"); }
};
struct C : A, B
{
virtual void bfn() { puts("C::B::bfn"); }
};
void Bcall(B& b)
{
b.bfn();
}
int main()
{
C c;
puts("calling C::B::bfn crashes...");
Bcall(c);
return 0;
}