[Insight-users] Why classes attributes should be private in ITK?

Joshua Cates cates at sci.utah.edu
Wed, 14 Apr 2004 10:21:43 -0600 (MDT)


Hi,

Where appropriate, private variables in ITK classes should have accessor
methods (Get/Set) that can be used for access from subclasses.  If you
find that there are variables you need to access from your own derived ITK
classes that do not already have accessor methods, you can propose that
accessor methods be added.  Just post a "feature request"  through
Bugzilla at www.itk.org.

Josh.

______________________________
 Josh Cates			
 Scientific Computing and Imaging Institute
 University of Utah
 (801) 587-7697
 http://www.sci.utah.edu/~cates


On Wed, 14 Apr 2004, Lemeur Yann wrote:

> Hi everybody!
> 
> I've used ITK for about a month and I wonder why almost all classes
> variables are private.  Actually, I have a problem when I want to create
> a class (class B) which inherit from a mother-class (called class A) in
> order to change one method (in my case: adding some lines of code to
> GenerateData() ). If this method needs to access to class variables
> which are private (defined in class A), I can't reimplement it in my new
> class B because variables are private in the mother class A. I also
> can't redefine the variables of A with the same name in B!
> 
> The only solution I've found is to write a "sister class" which inherit
> from the same class as A, and which is the same as A excepted the few
> changes I want to add. Does somebody know another solution to make it
> properly (ie to avoid to rewrite classes which don't change!) And I also
> wonder what is the interest to declare all the class variables private?
> 
> Thanks!
> Yann   
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>