Overloading/Inheritance issue

Aarti_pl aarti at interia.pl
Thu Aug 2 03:14:05 PDT 2007


Regan Heath pisze:

> #include <stdio.h>
> 
> class Base
> {
> public:
>     void foo()
>     {
>         printf("Base::foo()\n");
>     }
> 
>     void foo(int i)
>     {
>         printf("Base::foo(i)\n");
>     }
> };
> 
> class Child : Base
> {
> public:
>     void foo(int i)
>     {
>         printf("Child::foo(i)\n");
>     }
> };
> 
> void main()
> {
>     Child c;
>     c.foo();
> }
> 
> Some references to Walters original comments on the topic.  Anyone who 
> is interested should probably read this entire thread (though it is a 
> monster) to get a really clear picture of the problems associated with 
> this:
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=6975 
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=7053 
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=7063 
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=7137 
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=7149 
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=7057 
> 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=7072 
> 
> 
> I could keep linking all day... these are all from the same thread so 
> starting at the top and reading the whole thread should give you a fair 
> idea of the issues.
> 
> Regan

ups... my argument from last post falled down into ruins...

I am little bit shocked that C++ does it same way as D... As I did not 
yet read all mentioned threads, currently I am not telling any word more :-)

Regards
Marcin Kuszczak
(Aarti_pl)



More information about the Digitalmars-d mailing list