Re: What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/16/19 12:25 PM, Neia Neutuladh wrote: On Wed, 16 Jan 2019 12:01:06 -0500, Steven Schveighoffer wrote: It was 2.068 that removed the HiddenFuncError, and made this a compile error instead. If your compiler is that or newer, definitely file a bug report. Oh god, that must have been awful.

Re: What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-16 Thread Neia Neutuladh via Digitalmars-d-learn
On Wed, 16 Jan 2019 12:01:06 -0500, Steven Schveighoffer wrote: > It was 2.068 that removed the HiddenFuncError, and made this a compile > error instead. If your compiler is that or newer, definitely file a bug > report. Oh god, that must have been awful. I'm glad we're no longer in those

Re: What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-16 Thread Vijay Nayar via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 17:01:06 UTC, Steven Schveighoffer wrote: On 1/14/19 2:30 PM, Neia Neutuladh wrote: On Mon, 14 Jan 2019 09:10:39 +, Vijay Nayar wrote: a.foo(1); // issues runtime error (instead of calling A.foo(int)) Calling the function doesn't issue any sort of

Re: What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/14/19 2:30 PM, Neia Neutuladh wrote: On Mon, 14 Jan 2019 09:10:39 +, Vijay Nayar wrote: a.foo(1); // issues runtime error (instead of calling A.foo(int)) Calling the function doesn't issue any sort of error. Overriding one overload without overloading or explicitly aliasing in

Re: What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-14 Thread Neia Neutuladh via Digitalmars-d-learn
On Mon, 14 Jan 2019 09:10:39 +, Vijay Nayar wrote: > a.foo(1); // issues runtime error (instead of calling > A.foo(int)) Calling the function doesn't issue any sort of error. Overriding one overload without overloading or explicitly aliasing in the rest issues a compile-time error.

Re: What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-14 Thread ag0aep6g via Digitalmars-d-learn
On 14.01.19 10:10, Vijay Nayar wrote: After a bit of reading, I understood the rule and how it works, but what I'm missing is the "why".  Why is it desirable to hide methods from a parent class which have the same name (but different arguments) as a method in a class?

What is the Utility of Parent Class Method Hiding in Inheritance?

2019-01-14 Thread Vijay Nayar via Digitalmars-d-learn
https://dlang.org/spec/function.html#function-inheritance Consider this snippet from the documentation: class A { int foo(int x) { ... } int foo(long y) { ... } } class B : A { override int foo(long x) { ... } } void test() { B b = new B(); b.foo(1); // calls B.foo(long),