mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 02:43:14 +01:00
* Now 50/51 tests compile. * Added a simple runalltests.d scripts that should be run with 'gdmd -run runalltests.d' - LLVMDC will not compile it yet.
38 lines
368 B
D
38 lines
368 B
D
module classes6;
|
|
|
|
class C
|
|
{
|
|
void f()
|
|
{
|
|
printf("world\n");
|
|
}
|
|
}
|
|
|
|
class D : C
|
|
{
|
|
void f()
|
|
{
|
|
printf("moon\n");
|
|
}
|
|
}
|
|
|
|
|
|
extern(C)
|
|
{
|
|
void srand(uint seed);
|
|
int rand();
|
|
}
|
|
|
|
import llvm.intrinsic;
|
|
|
|
void main()
|
|
{
|
|
C c;
|
|
srand(readcyclecounter());
|
|
if (rand() % 2)
|
|
c = new C;
|
|
else
|
|
c = new D;
|
|
c.f();
|
|
}
|