Method hiding [Was: Re: System programming in D]
Jesse Phillips
jessekphillips+D at gmail.com
Wed Jan 4 19:32:31 PST 2012
On Thursday, 5 January 2012 at 01:36:44 UTC, bearophile wrote:
> Walter:
>
>> What is dangerous is (in C++) the ability to override a
>> non-virtual function, and the use of non-virtual destructors.
>
> There is something left that I'd like to see D care more about,
> method hiding:
>
>
> class Foo {
> string name = "c1";
> static void foo() {}
> }
> class Bar : Foo {
> string name = "c2";
> static void foo() {} // silent method hiding
> }
> void main() {}
Should we just disallow this? If the function wasn't static it
would just override foo. Or is that changing once override is
required?
More information about the Digitalmars-d
mailing list