Hello!

I'm building a class which has a constructor that is supposed to fill the
properties of the class based on the content of the object submitted to the
constructor. To better explain, here's how it is supposed to work:

var argsObj:Object = new Object();
argsObj.property1 = "hello";

var myObject:customObject = new customObject(argsObj);

customObject has a property called property1, and so does argsObj.

Now, the question is; how can I, in a simple way, put what ever is in the
argsObj in the correct place in my customObject? What will the constructor
look like?

Should I use setter functions, og set the property directly (this.property =
arg)? I can see the advantage of using setter's. I could easily sense if one
property is not of the correct type, and then do something. But, maybe I can
to that in the constructor?


This wasn't easy to explain, but I hope you understand.

Regards
Thomas Viktil

Reply via email to