[vtkusers] Superclass not being set correctly?

David Doria daviddoria+vtk at gmail.com
Wed Dec 2 16:50:40 EST 2009


I have 2 classes, vtkImageCamera that inherits from vtkPhysicalCamera -

class vtkImageCamera : public vtkPhysicalCamera

The PrintSelf function of the derived class is:

void vtkImageCamera::PrintSelf(ostream& os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os,indent);
  os << "new info here.";
}

When I output the derived class, I'd expect it to first call PrintSelf
of vtkPhysicalCamera. However, the vtkImageCamera::PrintSelf thinks
the Superclass is vtkObject and it never calls
vtkPhysicalCamera::PrintSelf.

The output of:
vtkstd::cout << "ImageCamera Superclass: " <<
this->Superclass::GetClassName() << vtkstd::endl;

is
ImageCamera Superclass: vtkImageCamera

Is there something that needs to be done manually to set the
SuperClass variable to vtkPhysicalCamera?
The vtkObject::PrintSelf function is called, but it skips the
vtkPhysicalCamera::PrintSelf.

Here is an extracted example of the problem:
http://www.rpi.edu/~doriad/VTK_List/SuperClass/

Thanks,

David



More information about the vtkusers mailing list