dup field in sub-class should be reported by the compiler

Walter Bright newshound1 at digitalmars.com
Mon Aug 13 15:04:23 PDT 2007


Chris Nicholson-Sauls wrote:
> Or, as has happened to me a time or two, the programmer may not even 
> /know/ what's in the super class, if deriving from a class provided by a 
> library for example.  (This is particularly true with private fields, of 
> course.)

Exactly what problem does this solve? If you're writing a derived class, 
and you create another field of the same name as a field in the base 
class, what bug has been created? The base class functions will still 
use the base class field, the derived class functions will still use the 
derived class field. The fields aren't polymorphic, so no hijacking can 
happen.

I just don't see the issue.




More information about the Digitalmars-d mailing list