summaryrefslogtreecommitdiff
path: root/tests/typing/bad/diamond.cpp
blob: fe59cebe50aa127c2eea6a7b14e24d816ae522d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>


class A { public :
  int a;
};

class B : public A { public :
  int b;
};

class C : public A { public :
  int c;
};

class D : public B, public C { public :
  int d;
};



void f(A* ap) {std::cout << ap->a << "\n";}

int main () {

  D* dp = new D();
  dp->a = 42;
  std::cout << dp-> a << "\n";

  f(dp);

  return 0;
}