Re: What is the design reasons for Not considering base class overloaded

2011-05-27 Thread Matthew Ong
On 5/25/2011 5:43 PM, bearophile wrote: alias A.foo foo; // ### Why the extra steps is needed for the compiler to 'know' overloaded functions from base classes? Others have already answered. I also suggest you to compile your code using the -w switch when possible. Bye, bearophile That is

Re: What is the design reasons for Not considering base class overloaded

2011-05-27 Thread Matthew Ong
On 5/27/2011 2:03 PM, Matthew Ong wrote: Would not it be a better keyword such as: class A{ // assuming there is a new keyword of noinherit noinherit void foo(int x){} // all other method can be inherited in A except for this class } Ignore the last message on new noinherit, just remember we

Re: What is the design reasons for Not considering base class overloaded function?

2011-05-25 Thread Ali Çehreli
On 05/24/2011 10:28 PM, Matthew Ong wrote: However, when doing overload resolution, the functions in the base class are not considered: // ### Why Not? Since B is a subset of A, and within B itself methods inherited from A can be called. b.foo(1); // calls B.foo(long), since

Re: What is the design reasons for Not considering base class overloaded

2011-05-25 Thread bearophile
Matthew Ong: This may sound inefficient, but since the D compiler knows all of the class hierarchy when generating code, all functions that are not overridden can be optimized to be non-virtual. This is pure theory, little more than advertisement. Also because D supports separate

Re: What is the design reasons for Not considering base class overloaded function?

2011-05-25 Thread Ali Çehreli
On 05/24/2011 11:42 PM, Jacob Carlborg wrote: Yes, but all declarations in classes or modules are public by default. Thanks for the correction. All this time I've been thinking the opposite. My understanding seemed correct, since most of the little programs that I've written have been in a