# Variable Typing Question

**URL:** https://forum.kirupa.com/t/variable-typing-question/249429
**Category:** flash
**Created:** [January 18, 2008, 5:45pm UTC](https://forum.kirupa.com/t/variable-typing-question/249429 "2008-01-18T17:45:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sixfngers](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@sixfngers](https://forum.kirupa.com/u/sixfngers)
#### Post date: [January 18, 2008, 5:45pm UTC](https://forum.kirupa.com/t/variable-typing-question/249429/1 "2008-01-18T17:45:37Z")

</div>

So lets say I have a function in which I drag around a Display Object.

if i pass that function the Object to be dragged how do i type the variable.

```auto

function drag(targ:Sprite)
{
  //do drag stuff
  //but what if the targ is a Movieclip
}
 

```

if I cast the object to Sprite should this take place when the function is called?

drag(Sprite(clip))
