Mercurial > projects > dstress
changeset 280:8e103eba0fb4
covariant return statements (classes)
Stewart Gordon <smjg_1998@yahoo.com>
2005-02-11
news:cui1u9$1kl1$1@digitaldaemon.com
nntp://news.digitalmars.com/digitalmars.D.bugs/2943
author | thomask |
---|---|
date | Sat, 12 Feb 2005 00:39:37 +0000 |
parents | f8307bca5f97 |
children | b8b7a330468a |
files | run/overload_17.d run/overload_18.d |
diffstat | 2 files changed, 58 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/overload_17.d Sat Feb 12 00:39:37 2005 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg_1998@yahoo.com> +// @date@ 2005-02-11 +// @uri@ news:cui1u9$1kl1$1@digitaldaemon.com +// @url@ nntp://news.digitalmars.com/digitalmars.D.bugs/2943 + +module dstress.run.overload_17; + +class Parent { + Parent check(){ + return new Parent; + } +} + +class Sister : Parent { + Brother check(){ + return new Brother; + } +} + +class Brother : Parent { +} + +int main(){ + Parent p = (new Sister()).check(); + return 0; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/overload_18.d Sat Feb 12 00:39:37 2005 +0000 @@ -0,0 +1,28 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg_1998@yahoo.com> +// @date@ 2005-02-11 +// @uri@ news:cui1u9$1kl1$1@digitaldaemon.com +// @url@ nntp://news.digitalmars.com/digitalmars.D.bugs/2943 + +module dstress.run.overload_18; + +class Parent { + Parent check(){ + return new Parent; + } +} + +class Sister : Parent { + Sister check(){ + return new Sister(); + } +} + + +int main(){ + Parent p = (new Sister()).check(); + return 0; +} \ No newline at end of file