Hidden get method for properties

Stewart Gordon smjg_1998 at yahoo.com
Wed Jul 19 15:38:00 PDT 2006


Hasan Aljudy wrote:
> 
> sclytrack at pi.be wrote:
>> I've only been using D sinds June 2006, I stumbled accross this today.
>> 
>> Is this normal D behavior that int number() is no longer accessible 
>> from the
>> derived class while backupNumber still is?
>> I can work around this, without problems. :-)
>> 
>> dmd v0.163
> 
> It's got to do with function overloading in the derived class.
> When you overload number in Derived, you lose visibility to the other 
> number method(s).
> 
> As for why is that? I don't know. Maybe to prevent possible confusion.
<snip>

It carries over from C++ days.  AIUI the point is to avert a scenario 
whereby a base class can gain a new overload of the method name, and 
thereby cause a call to use this instead of your function in the derived 
class.  See

http://tinyurl.com/owwve

Stewart.



More information about the Digitalmars-d-learn mailing list