mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 10:53:14 +01:00
31 lines
417 B
D
31 lines
417 B
D
module innerclass1;
|
|
extern(C) int printf(char*, ...);
|
|
|
|
class Outer
|
|
{
|
|
int i;
|
|
class Inner
|
|
{
|
|
int func()
|
|
{
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
Outer o = new Outer;
|
|
{
|
|
o.i = 42;
|
|
{
|
|
auto i = o.new Inner;
|
|
{
|
|
int x = i.func();
|
|
assert(x == 42);
|
|
}
|
|
}
|
|
}
|
|
printf("SUCCESS\n");
|
|
}
|