# Upcasting vtkSmartPointer

**URL:** https://discourse.vtk.org/t/upcasting-vtksmartpointer/935
**Category:** Support
**Created:** [May 9, 2019, 11:01am UTC](https://discourse.vtk.org/t/upcasting-vtksmartpointer/935 "2019-05-09T11:01:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 9, 2019, 11:01am UTC](https://discourse.vtk.org/t/upcasting-vtksmartpointer/935/1 "2019-05-09T11:01:36Z")

</div>

Greetings,

The (legacy) code below that used to compile:

```
 vtkSmartPointer<vtkLookupTable> lut = Util::getColorTable( ColorTable::RAINBOW, min, max);
 ...
 pointCloudMapper->SetLookupTable(lut);

```

Now I get `no known conversion for argument 1 from 'vtkSmartPointer<vtkLookupTable>' to 'vtkScalarsToColors*'` what gives? As far as I know `vtkLookupTable` inherits from `vtkScalarsToColors`. How do I upcast the smart pointer? I can’t change the type of pointer returned by the `getColorTable()` function.

any help will be much appreciated.

Paulo

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 9, 2019, 4:33pm UTC](https://discourse.vtk.org/t/upcasting-vtksmartpointer/935/2 "2019-05-09T16:33:53Z")

</div>

There is no such thing as upcasting (it is implicit). Make sure to `#include` all related header files.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 9, 2019, 5:25pm UTC](https://discourse.vtk.org/t/upcasting-vtksmartpointer/935/3 "2019-05-09T17:25:00Z")

</div>

True… there was missing an include that was being included indirectly in the legacy code. Thanks for the heads up.
