# Class with static function-like constructor

**URL:** <https://forum.kirupa.com/t/class-with-static-function-like-constructor/315025>\
**Category:** Uncategorized\
**Created:** [October 15, 2010, 12:05pm UTC](https://forum.kirupa.com/t/class-with-static-function-like-constructor/315025 "2010-10-15T12:05:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![artheus](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@artheus](https://forum.kirupa.com/u/artheus)\
**Post date:** [October 15, 2010, 12:05pm UTC](https://forum.kirupa.com/t/class-with-static-function-like-constructor/315025/1 "2010-10-15T12:05:46Z")

</div>

Hey!

I’m currently writing a class where I’d like to call the class constructor without having to instantiate the class itself. Something like this :

Class:

```auto

package
{
    public class ClassName
    {
        public function ClassName(text:String):String
        {
            text = text + " test123";
            return text;
        }
    }
}

```

Usage:

```auto

import ClassName;

var testString = ClassName("test");

trace(testString); //wil trace the text "test test123"

```

Is it possible to somehow achieve this? When I write the costructor method like “public static function ClassName” it fails. Is there any other way?

Cheers,  
Artheus
