On 2018-03-02 21:23, Christian Köstlin wrote:
To give an example:
class Thread {
...
Thread start() {...}
}
class Timer : Thread {
...
}
void main() {
// Timer timer = new Timer().start; // this does not work
auto timer = new Timer().start; // because timer is of type Thread
}
You can also try a template this parameter [1] in the base class:
class Thread
{
T start(this T) () { ... }
}
But if this "Thread" is core.thread.Thread that won't work.
[1] https://dlang.org/spec/template.html#template_this_parameter
--
/Jacob Carlborg