Mercurial > projects > dstress
changeset 259:55f5fa58d38e
function overloading / resolving
Nick Sabalausky <z@a.a>
2005-02-01
news:ctpknf$21se$1@digitaldaemon.com
nntp://news.digitmars.com/digitalmars.D.bugs
author | thomask |
---|---|
date | Thu, 03 Feb 2005 03:55:43 +0000 |
parents | 8cff0c780abb |
children | c47a1fee9989 |
files | run/overload_14.d run/overload_15.d run/overload_16.d |
diffstat | 3 files changed, 123 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/overload_14.d Thu Feb 03 03:55:43 2005 +0000 @@ -0,0 +1,41 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Nick Sabalausky <z@a.a> +// @date@ 2005-02-01 +// @uri@ news:ctpknf$21se$1@digitaldaemon.com +// @url@ nntp://news.digitmars.com/digitalmars.D.bugs + +module dstress.run.overload_14; + +int status; + +void check(int x){ + status++; +} + +class MyClass{ + void test(){ + assert(status==0); + check(0); + assert(status==1); + check(); + assert(status==3); + } + + void check(){ + assert(status==1); + status+=2; + } +} + +int main(){ + MyClass c = new MyClass(); + assert(status==0); + c.test(); + assert(status==3); + check(0); + assert(status==4); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/overload_15.d Thu Feb 03 03:55:43 2005 +0000 @@ -0,0 +1,41 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Nick Sabalausky <z@a.a> +// @date@ 2005-02-01 +// @uri@ news:ctpknf$21se$1@digitaldaemon.com +// @url@ nntp://news.digitmars.com/digitalmars.D.bugs + +module dstress.run.overload_15; + +int status; + +void check(int x){ + status++; +} + +class MyClass{ + void test(){ + assert(status==0); + .check(0); + assert(status==1); + check(); + assert(status==3); + } + + void check(){ + assert(status==1); + status+=2; + } +} + +int main(){ + MyClass c = new MyClass(); + assert(status==0); + c.test(); + assert(status==3); + check(0); + assert(status==4); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/overload_16.d Thu Feb 03 03:55:43 2005 +0000 @@ -0,0 +1,41 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Nick Sabalausky <z@a.a> +// @date@ 2005-02-01 +// @uri@ news:ctpknf$21se$1@digitaldaemon.com +// @url@ nntp://news.digitmars.com/digitalmars.D.bugs + +module dstress.run.overload_16; + +int status; + +void check(int x){ + status++; +} + +class MyClass{ + void test(){ + assert(status==0); + .check(0); + assert(status==1); + .check(); + assert(status==3); + } + + void check(){ + assert(status==1); + status+=2; + } +} + +int main(){ + MyClass c = new MyClass(); + assert(status==0); + c.test(); + assert(status==3); + check(0); + assert(status==4); + return 0; +}