Skip to content
Snippets Groups Projects
Commit 799a12e9 authored by Julien Malik's avatar Julien Malik
Browse files

BUG : Ensure calling CopyAttributesFrom via polymorphism really calls the overridden method

parent c3e14e66
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,7 @@ public:
/** Standard class typedefs */
typedef AttributesMapLabelObject Self;
typedef itk::LabelObject< TLabel, VImageDimension > Superclass;
typedef typename Superclass::LabelObjectType LabelObjectType;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::WeakPointer <const Self> ConstWeakPointer;
......@@ -187,11 +188,18 @@ public:
/**
* This method is overloaded to add the copy of the attributes map.
*/
virtual void CopyAttributesFrom( const Self * src)
virtual void CopyAttributesFrom( const LabelObjectType * lo)
{
Superclass::CopyAttributesFrom( src );
Superclass::CopyAttributesFrom( lo );
// copy the data of the current type if possible
const Self * src = dynamic_cast<const Self *>( lo );
if( src == NULL )
{
return;
}
m_Attributes = src->m_Attributes;
}
}
/** Return the polygon (const version) */
const PolygonType * GetPolygon() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment