[vtkusers] bizarre error

Yianis Nikolaou yianisn at gmail.com
Wed Aug 3 10:09:15 EDT 2005


hi Louis,

as you can see on the VTK manual

"...vtkDataArray is an abstract superclass for data array objects..."

and obviously you cannot instantiate an abstract class.

What you probably need is an array of ints, chars, floats or whatever,
so you create a vtkIntArray, vtkCharArray and vtkFloatArray respectively.

The reason that most filters use or return vtkDataArray is polymorphism.

HTH
best regards,
yianis nikolaou

On 8/3/05, Louis Desjardins <lost_bits1110 at hotmail.com> wrote:
> 
> Hi experts,
> 
> So I declare an object of type vtkDataArray, like so
> 
> In my header file I have:
> vtkDataArray *a1;
> vtkDataArray *a2;
> 
> and then in the constructor of this class I have:
> a1 = vtkDataArray::New();
> a2 = vtkDataArray::New();
> 
> however I get an error pointing to these 2 lines of code which goes:
> 
> mycode.cpp: In constructor
> `mycode::mycode()': mycode.cpp:45: error: invalid conversion from
> `vtkObject*' to`vtkDataArray*' mycode:46: error: invalid conversion from
> `vtkObject*' to `vtkDataArray*'
> 
> which seems very very bizarre since I've include "vtkDataArray.h"..?
> i realize this is a very basic question but if someonoe thinks they have 
> any
> idea waht might be goign wrong, it would be very appreciated
> 
> thank you!
> -LD
> 
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050803/ceed6015/attachment.htm>


More information about the vtkusers mailing list