1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | #include <stdint.h> |
4 | |
5 | struct Shape |
6 | { |
7 | bool dummy; |
8 | Shape() : dummy(true) {} |
9 | }; |
10 | |
11 | struct Rectangle : public Shape { |
12 | int w; |
13 | int h; |
14 | Rectangle(int W = 3, int H = 5) : w(W), h(H) {} |
15 | }; |
16 | |
17 | struct Circle : public Shape { |
18 | int r; |
19 | Circle(int R = 6) : r(R) {} |
20 | }; |
21 | |
22 | int main (int argc, const char * argv[]) |
23 | { |
24 | Rectangle r1(5,6); |
25 | Rectangle r2(9,16); |
26 | Rectangle r3(4,4); |
27 | |
28 | Circle c1(5); |
29 | Circle c2(6); |
30 | Circle c3(7); |
31 | |
32 | Circle *c_ptr = new Circle(8); |
33 | Rectangle *r_ptr = new Rectangle(9,7); |
34 | |
35 | return 0; // Set break point at this line. |
36 | } |
37 | |
38 | |