[vtk-developers] Calling methods on superclasses

Andy Cedilnik andy.cedilnik at kitware.com
Fri Jan 10 13:34:23 EST 2003


Hi All,

I noticed that several classes in VTK refer to its parent classes method
by specifying the parent class name. Here is an example in
vtkStructuredGrid.h:

this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 );

This is valid C++, works fine on all platforms, but can lead to problems
when superclass is changed. For example if the superclass is not
vtkPointSet any more or if another class is inserted between, the code
might break. I suggest before 4.2 we modify code to use the typedef from
vtkTypeRevisionMacro called Superclass. The previous example should
therefore look like this:

this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 );

Any comments?

				Andy




More information about the vtk-developers mailing list