xxxxxxxxxx
void main()
{
import core.stdc.math : sin;
import core.thread;
import std.stdio : write, writeln, writef, writefln;
class DerivedThread : Thread
{
double d;
this()
{
super(&run);
}
this(double a)
{
super(&run);
this.d = sin(a);
writeln(d);
this.getD();
}
private:
auto setD(double d)
{
this.d = d;
return this;
}
double getD()
{
writeln(d);
return d;
}
void run()
{
// Derived thread running.
}
}
// create and start instances of each type
auto derived = new DerivedThread(22);
derived.start(); // start always returns Thread, not your DerivedThread - you should cast to get DerivedThread here
derived.setD(11).getD();
}