Ticket #329: ctor-test.cpp

File ctor-test.cpp, 260 bytes (added by cladisch, 7 years ago)

static constructors test program

Line 
1 #include <cstdio>
2
3 int f()
4 {
5         std::puts("f()");
6         return 17;
7 }
8
9 int i = f();
10
11 struct C {
12         int m;
13         C();
14         ~C();
15 };
16
17 C::C(): m(23)
18 {
19         std::puts("C::C");
20 }
21
22 C::~C()
23 {
24         std::puts("C::~C");
25 }
26
27 C c;
28
29 int main()
30 {
31         std::printf("i: %d, c.m: %d\n", i, c.m);
32         return 0;
33 }