Mercurial > projects > dstress
changeset 1052:b524fdde8950
BCS <BCS@pathlink.com>
2006-06-05
news:e62g7t$1084$1@digitaldaemon.com
author | thomask |
---|---|
date | Thu, 29 Jun 2006 13:25:17 +0000 |
parents | 7106229d4169 |
children | 136829b474f9 |
files | run/f/function_07_A.d run/f/function_07_B.d |
diffstat | 2 files changed, 62 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/function_07_A.d Thu Jun 29 13:25:17 2006 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ BCS <BCS@pathlink.com> +// @date@ 2006-06-05 +// @uri@ news:e62g7t$1084$1@digitaldaemon.com + +module dstress.run.f.function_07_A; + +struct S{ + static int inc(int i){ + return i + 1; + } +} + +int main(){ + int function(int) f; + S s; + + with(s){ + f = &inc; + } + + if(f(2) != 3){ + assert(0); + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/function_07_B.d Thu Jun 29 13:25:17 2006 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ BCS <BCS@pathlink.com> +// @date@ 2006-06-05 +// @uri@ news:e62g7t$1084$1@digitaldaemon.com + +module dstress.run.f.function_07_B; + +class S{ + static int inc(int i){ + return i + 1; + } +} + +int main(){ + int function(int) f; + S s; + + with(s){ + f = &inc; + } + + if(f(2) != 3){ + assert(0); + } + + return 0; +} +