dup field in sub-class should be reported by the compiler
Regan Heath
regan at netmail.co.nz
Wed Aug 15 01:22:41 PDT 2007
Walter Bright wrote:
> Walter Bright wrote:
>> Brad Roberts wrote:
>>> On Mon, 13 Aug 2007, Walter Bright wrote:
>>>> I just don't see the issue.
>>>
>>> Apply this same logic to variable shadowing. Shadowing has been
>>> declared illegal.
>>
>> While pedantically it is the same logic, but practically I think it's
>> very different. I don't see writing derived classes like one writes a
>> nested scope.
>
> I want to add to that. For a nested scope, there really isn't any
> barrier to renaming something. For a derived class, however, you have
> users of it, and you may need to specifically hide a base member.
For that you can re-use override, eg.
class A
{
int x;
}
class B
{
override int x;
}
Regan
More information about the Digitalmars-d
mailing list