OT: Calling delete on 'this' from member function

Regan Heath regan at netmail.co.nz
Sun May 13 08:23:13 PDT 2007


One further question, is it actually valid to call delete this in a non-static method of a class as shown below.  It seems to work but I would not have thought it possible...

> # class Threader : Thread {
> # 	int run() {
> # 		delete this;
> # 		return 0;
> # 	}
> # }

Regan Heath



More information about the Digitalmars-d mailing list