Mercurial > projects > dstress
changeset 224:7d62be503e5f
this in class constructor/destructor
Jarrett Billingsley <kb3ctd2@yahoo.com>
2004-12-30
news:cr19ka$q75$1@digitaldaemon.com
nntp://digitalmars.com/digitalmars.D/14115
author | thomask |
---|---|
date | Sat, 01 Jan 2005 15:15:41 +0000 |
parents | 9603ea1557fc |
children | a17c5241fa96 |
files | run/this_03.d |
diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/this_03.d Sat Jan 01 15:15:41 2005 +0000 @@ -0,0 +1,29 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Jarrett Billingsley <kb3ctd2@yahoo.com> +// @date@ 2004-12-30 +// @uri@ news:cr19ka$q75$1@digitaldaemon.com +// @url@ nntp://digitalmars.com/digitalmars.D/14115 + +module dstress.run.this_03; + +class Node{ + static Node[Node] nodes; + + this(){ + nodes[this]=this; + } + + ~this(){ + delete nodes[this]; + } +} + +int main(){ + assert(Node.nodes.length==0); + Node n = new Node(); + assert(Node.nodes.length==1); + return 0; +} \ No newline at end of file