aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_inherit.in
blob: ae5b819d938129e9b66e9504fdae5997b2e2cdb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
struct Parent {
  int x1, x2;
};
struct Child : Parent {
  int y;
};
int main() {
  Parent a;
  a.x1 = 50;
  a.x2 = 87;
  Child b;
  b.x1 = 78;
  b.x2 = 550;
  b.y = 101;
  Child* c = (Child*)&a;
  c->x1++;
  c = &b;
  c->y--;
  printf("*%d,%d,%d,%d,%d,%d,%d*\n", a.x1, a.x2, b.x1, b.x2, b.y, c->x1, c->x2);
  return 0;
}