[vtkusers] multiple inheritance or RTTI

Stefano Perticoni stperti at infinito.it
Fri Feb 16 05:03:41 EST 2001

Deriving from vtk classes is it a good practice to use multiple inheritance
or should i use only single inheritance and RTTI if i want to insert an
object vtkPegasus in a list together with vtkHorse and vtkBird objects?

1)  class vtkPegasus : public vtkHorse, public vtkBird {}

2) class vtkPegasus : public vtkHorse {}
    vtkHorse*  pvtkHorse =new vtkHorse
    vtkHorse*  pvtkHorse =new vtkPegasus
    list<vtkHorse*>  lHorse
   vtkPegasus* pvtkPegasus=dynamic_cast<vtkPegasus*>(
   traversing the lHorse list...)
   if (pvtkPegasus)
    //ok, it's a vtkPegasus*
    //it's just a vtkHorse

Should i use 1) or 2) ?
I ask this question because reading online man pages vtk source
seems to use single inheritance only.

More information about the vtkusers mailing list