[Insight-developers] bcc error
Joshua Cates
cates@sci.utah.edu
Wed, 8 Jan 2003 17:47:42 -0700 (MST)
Hi Luis,
Yes I thought about doing it this way and depending on inlining. That may
be the best option.
Thanks,
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
On Wed, 8 Jan 2003, Luis Ibanez wrote:
> Hi Josh,
>
> Borland definetly manage the access
> rights of derived classes in a particular
> (non-standard) way.
>
> We had a similar problem in the past when
> creating the STL adaptor for the VectorContainer.
> At the end we compromised in letting the
> derivation be public. (not an optimal solution).
>
>
> It is unfortunate the Borland does that since
> this is a pretty basic functionality.
>
>
> As an alternative...
> Wouldn't be ok if insted of exposing the method
> you delegate from the base class ?
>
> like
>
>
> class ConstShapedNeighborhoodIterator : private NeighborhoodIterator
> {
> public:
> GetPixel()
> {
> Superclass::GetPixel(); // invoke the method in the base class
> }
> protected:
> SetPixel()
> {
> Superclass::SetPixel; // invoke the method in the base class
> }
>
> };
>
>
> Hopefully the methods will be inlined and no
> performance penalty will occur...
>
>
>
> Luis
>
>
> ---------------------------------------------
>
> Joshua Cates wrote:
>
> > 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
> >
> >
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-developers
> >
> >
>
>
>