# Override constructor

**URL:** <https://forum.kirupa.com/t/override-constructor/263175>\
**Category:** flash\
**Created:** [June 13, 2008, 3:01am UTC](https://forum.kirupa.com/t/override-constructor/263175 "2008-06-13T03:01:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)\
**Post date:** [June 13, 2008, 3:01am UTC](https://forum.kirupa.com/t/override-constructor/263175/1 "2008-06-13T03:01:46Z")

</div>

Hi there…

Okay just quick shoot…here…ok just curiousity here…from my digging and reading I know that we can’t override constructor…but might possiblity can be achieve…so I really need some shed on light from expertise people or some ideas how to achieve it…here’s the my portions curiousity…

```auto

//let's say

class TestClass{
    var __a:String;
    var __b:Number

//==================constructor==============
    function TestClass(a:String){
       __a = a;
    }

    function TestClass(b:Number){
      __b = b;
    }
//==================constructor==============

}

```

//my curiosity is how to override constructor I mean give an options to me in order to to string params or numbers param2 either…

```auto

eg;

var test:TestClass = new TestClass("test");

var test:TestClass = new TestClass(2);

```

It is because my goal purposely wanna rectifying what of the datatype parameters being passing inside the class whether string or number…that’s all is it possible…???  
Any help are really appreciated

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [June 13, 2008, 4:03am UTC](https://forum.kirupa.com/t/override-constructor/263175/2 "2008-06-13T04:03:58Z")

</div>

Type the parameter as Object.

---

<div class="post-metadata">

**Author:** ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)\
**Post date:** [June 13, 2008, 7:47am UTC](https://forum.kirupa.com/t/override-constructor/263175/3 "2008-06-13T07:47:11Z")

</div>

> [@TheCanadian;2341952](#):
>
> Type the parameter as Object.

Thanks TheCanadian…I just check the type of parameter as u suggest it works ok now…tq mate…
