[Insight-developers] bcc error

Joshua Cates cates@sci.utah.edu
Wed, 8 Jan 2003 17:09:23 -0700 (MST)


Hi all,

I'm puzzled by an error I'm getting from the Borland compiler.  I don't 
understand why it is identified as an error.

The error results from the following construct:

class NeighborhoodIterator
{
public:
  void SetPixel(PixelType);
  PixelType GetPixel();
};

class ConstShapedNeighborhoodIterator : private NeighborhoodIterator
{
public:
  Superclass::GetPixel; // expose this method to the public interface
protected:
   Superclass::SetPixel;  // hide this method from public interface, but 
                          // keep it accessible to subclass
};

class ShapedNeighborhoodIterator : public ConstShapedNeighborhoodIterator
{
public:
  Superclass::SetPixel;  // expose again to public interface
};


Error E2009 
C:\itkQuality\Insight\Code\Common\itkConstShapedNeighborhoodIterator.h 
285: Attempt to grant or reduce access to 
'itk::NeighborhoodIterator<TestImageType,itk::ZeroFluxNeumannBoundaryCondition<TestImageType> 
>::SetPixel(const unsigned int,const itk::Index<4> &,bool &)' in function 
PrintShapedNeighborhood(const 
itk::ConstShapedNeighborhoodIterator<TestImageType,itk::ZeroFluxNeumannBoundaryCondition<TestImageType> 
> &)


My intent is, in fact, to reduce access to SetPixel in
ConstShapedNeighborhood.  Why should this be an error?  (Even vc++ allows
it.)  If I move the declaration of SetPixel to public in
ConstShapedNeighborhoodIterator, Borland is happy.

Josh.

______________________________
 Josh Cates			
 School of Computer Science	
 University of Utah
 Email: cates@sci.utah.edu
 Phone: (801) 587-7697
 URL:   http://www.sci.utah.edu/~cates