From: "Maurice le Rutte" <[EMAIL PROTECTED]> > > ----- Original Message ----- > From: "Kurt Huwig" <[EMAIL PROTECTED]> > > > Inheritance of fields is a Bad Thing (tm) IMHO. > > I've always thought that inheritance of fields was one of the core things of > OO... >
Well, allowing protected access does break the super class' encapsulation, allowing the subclass to violate the class invariant of the super class. So, in general, it is a bad thing. Providing accessors is not much better, though, unless you can restrict what the caller can do to the object (eg, const in C++). In the case of Ant tasks, the project field is not really part of the task's invariant, so protected access is not generally harmful. Conor
