[vtkusers] protected constructor/desctructor in vtk clases

Charl P. Botha c.p.botha at its.tudelft.nl
Tue May 6 13:27:34 EDT 2003


On Tue, 2003-05-06 at 19:09, Seema Jaisinghani wrote:
> it shows this error at the point of datablock
> constructor and destructor
> 
> c:\vtk_datavis\vtk_dynamicreader\datablock.h(50) :
> error C2248:
> 'vtkStructuredPoints::vtkStructuredPoints' : cannot
> access protected member declared in class
> 'vtkStructuredPoints'
>         c:\program
> files\vtk40\vtk\common\vtkstructuredpoints.h(74) : see
> declaration of
> 'vtkStructuredPoints::vtkStructuredPoints'
> 
> 
> I searched thru the list about this, and found that it
> has been done to avoid things like creating an array
> of vtk objects.
> Is their a solution around it and how do I work it
> out?

Never directly construct a vtk object, there's a REASON why the
constructor is protected.  Always use pointers to vtk objects and
instantiate with the static New() method.  Remember to call Delete() as
many times as you call New() for any object that you use.

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/



More information about the vtkusers mailing list