https://run.dlang.io/is/PQkOfF

How to make it work?
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:
        void setD(double d)
        {
            this.d = d;
        }

        double getD()
        {
            writeln(d);
            return d;
        }

        void run()
        {
            // Derived thread running.
        }
    }

    // create and start instances of each type
    auto derived = new DerivedThread(22).start().setD(11).getD();

}

Reply via email to