Is it possible to return the subclass from a method of the parent class in dlang?

Christian Köstlin christian.koestlin at gmail.com
Fri Mar 2 20:23:15 UTC 2018


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
}


thanks in advance,
christian



More information about the Digitalmars-d-learn mailing list