Mercurial > projects > dstress
changeset 532:3de87fd6e82d
resolving static class methods
xs0 <xs0@xs0.com>
2005-05-12
news:d5vnlr$9h6$1@digitaldaemon.com
author | thomask |
---|---|
date | Sat, 14 May 2005 04:41:03 +0000 |
parents | ac20ba639b79 |
children | c8f0ffd00273 |
files | run/s/static_30_A.d run/s/static_30_B.d run/s/static_30_C.d |
diffstat | 3 files changed, 88 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/static_30_A.d Sat May 14 04:41:03 2005 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ xs0 <xs0@xs0.com> +// @date@ 2005-05-12 +// @uri@ news:d5vnlr$9h6$1@digitaldaemon.com + +module dstress.run.s.static_30_A; + +class Foo{ + int hash(){ + return 0; + } + + static int hash(int val){ + return val+1; + } +} + +class Bar{ + int test(int i){ + return Foo.hash(i); + } +} + +int main(){ + assert(Foo.hash(10)==11); + Bar b = new Bar; + assert(b.test(10)==11); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/static_30_B.d Sat May 14 04:41:03 2005 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ xs0 <xs0@xs0.com> +// @date@ 2005-05-12 +// @uri@ news:d5vnlr$9h6$1@digitaldaemon.com + +module dstress.run.s.static_30_B; + +class Foo{ + int hash(){ + return 0; + } + + static int hash(int val){ + return val+1; + } +} + +int main(){ + assert(Foo.hash(10)==11); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/static_30_C.d Sat May 14 04:41:03 2005 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ xs0 <xs0@xs0.com> +// @date@ 2005-05-12 +// @uri@ news:d5vnlr$9h6$1@digitaldaemon.com + +module dstress.run.s.static_30_C; + +struct Foo{ + int hash(){ + return 0; + } + + static int hash(int val){ + return val+1; + } +} + +struct Bar{ + int test(int i){ + return Foo.hash(i); + } +} + +int main(){ + assert(Foo.hash(10)==11); + Bar b; + assert(b.test(10)==11); + return 0; +}