[vtkusers] multiple inheritance or RTTI
Stefano Perticoni
stperti at infinito.it
Fri Feb 16 05:03:41 EST 2001
Hi,
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 {}
//Main
vtkHorse* pvtkHorse =new vtkHorse
vtkHorse* pvtkHorse =new vtkPegasus
list<vtkHorse*> lHorse
//RTTI
vtkPegasus* pvtkPegasus=dynamic_cast<vtkPegasus*>(
traversing the lHorse list...)
//
if (pvtkPegasus)
//ok, it's a vtkPegasus*
else
//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.
Thanks,Stefano
More information about the vtkusers
mailing list