mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
in this regard. Code for accessing nested variables and contexts rewritten. Probably more. Fairly well tested.
24 lines
340 B
D
24 lines
340 B
D
module nested5;
|
|
extern(C) int printf(char*, ...);
|
|
|
|
void main()
|
|
{
|
|
int i = 42;
|
|
|
|
printf("Hello world %d\n", i++);
|
|
|
|
class C
|
|
{
|
|
void func()
|
|
{
|
|
printf("Hello nested world %d\n", i++);
|
|
//i++;
|
|
}
|
|
}
|
|
|
|
auto c = new C;
|
|
c.func();
|
|
printf("i = %d\n", i);
|
|
assert(i == 44);
|
|
}
|