[vtkusers] Check for class type

Leonardo M. Ramé l.rame at griensu.com
Thu Oct 21 08:46:45 EDT 2010


On 2010-10-21 08:41:11 -0400, David Doria wrote:
> On Thu, Oct 21, 2010 at 8:33 AM, Leonardo M. Ramé <l.rame at griensu.com>wrote:
> 
 >
> Here is a quote from Pat Marion:
> 
> GetClassName is great for debugging, but I wouldn't recommend it for
> comparisons.  For example, instead of:
> 
>       if (array->GetClassName() == std::string("vtkIdTypeArray")) cout <<
> "It's an id type array";
> 
> it is preferable to use:
> 
>       if (vtkIdTypeArray::SafeDownCast(array)) cout << "It's an id type
> array";
> 
> David

Thanks, SafeDownCast is wat I was looking for.

-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com



More information about the vtkusers mailing list