Skip to main content
summaryrefslogtreecommitdiffstats
blob: 6c9860528a15e9d57066107d651ca5e7b03c5d65 (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
34
35
36
37
38
39
40
41
42
#include <cstdio>
#include <unistd.h>

int x = 3;

class A {
public:
	A() : y(6) {}
	int c() {
		B b = B();
		b.d();
		return b.x + y;
	}
private:
	class B {
	public:
		B() : x(5) {}
		void d() {
			x++;
			e();
		}
		int x;
	private:
		void e() {
			x--;
		}
	};
	int y;
};

int main() {
	if (fork()) {
		A a = A();
		a.c();
	}
	else {
		execv("../cpptest/Debug/cpptest", NULL);
		perror("execv");
	}
	return 0;
}

Back to the top