4 extern "C" int printf (const char *, ...);
5 extern "C" int atoi (const char *);
11 A() { printf ("A is constructed.\n"); }
12 virtual void xx(int doit) { printf ("A is destructed.\n"); }
17 A1() { printf ("A1 is constructed.\n"); }
18 virtual void xx(int doit) { printf ("A1 is destructed.\n"); }
21 class B : public A1, public virtual A {
23 B() { printf ("B is constructed.\n"); }
24 virtual void xx(int doit) {
25 printf ("B is destructed.\n");
33 class C : public virtual A, public B {
35 C() { ++num; printf ("C is constructed.\n");
38 virtual void xx(int doit) {
41 printf("FAIL\n%x != %x\n", ptr, this);
42 printf ("C is destructed.\n");
49 printf ("Casting to A!\n");
53 printf ("Casting to A1!\n");
58 printf ("Casting to B!\n");
63 printf ("Casting to C!\n");
67 int main(int argc, char *argv[]) {
68 printf ("*** Construct C object!\n");
73 printf ("*** Try to delete the casting pointer!\n");