# A question about ++

**URL:** <https://forum.kirupa.com/t/a-question-about/242027>\
**Category:** Uncategorized\
**Created:** [October 21, 2007, 8:58am UTC](https://forum.kirupa.com/t/a-question-about/242027 "2007-10-21T08:58:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sger\_error](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@sger\_error](https://forum.kirupa.com/u/sger_error)\
**Post date:** [October 21, 2007, 8:58am UTC](https://forum.kirupa.com/t/a-question-about/242027/1 "2007-10-21T08:58:06Z")

</div>

hello,

i have one function that returns custom type:

public function addMC():MyCustomClass{

var mc:MyCustomClass = new MyCustomClass();  
addChild(MyCustomClass);  
mc.name = “mc”+id++;  
//id is number initialize in the constructor id = 0;  
return mc;

}

my problem is that i want to use addMC inside a loop something like this:

for(var i:int = 0; i\<5; i++){  
var mc:MyCustomClass = addMC();  
}

but the loop creates only one mc

any ideas?

Thanks
