Mercurial > projects > dstress
changeset 549:965b2cd4d7a9
package / overload
Kris <fu@bar.com>
2005-05-20
news:d6jaj8$2r1n$1@digitaldaemon.com
author | thomask |
---|---|
date | Fri, 20 May 2005 10:01:33 +0000 |
parents | 72745b846f1e |
children | e7330e57895f |
files | run/o/overload_23.d |
diffstat | 1 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/overload_23.d Fri May 20 10:01:33 2005 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Kris <fu@bar.com> +// @date@ 2005-05-20 +// @uri@ news:d6jaj8$2r1n$1@digitaldaemon.com + +module dstress.run.o.overload_23; + +class Base{ + package char[] name(){ + return "base"; + } +} + +class Derived:Base{ + package char[] name(){ + return "derived"; + } +} + +int main(){ + Base b = new Base; + assert(b.name=="base"); + + Derived d = new Derived; + assert(d.name=="derived"); + + Base bd = new Derived; + assert(bd.name=="derived"); + return 0; +}