Hello Harshini,
similarly to C++, Chora is a static typed programming language. This means that before source code is compiled, the type associated with each and every single variable must be known. In your case the type of the variable obj is known as object. Such variable can represent any object. This however without any assumption to the content of the object. If you want to access a data member of such object, you have to explicitly type-cast it to the expected class and test whether the type-cast was successful (whether the object stored in the variable really does represent the desired class). See also Type conversion: Object runtime cast.
In your case (you plan to create an instance of a dynamically specified class), you could also use the Type conversion: Class runtime cast to distinguish the different classes. Once the class is known, you can perform code dedicated to the known class. For example:
// Trying to create an object of the Int32Array class?
if ((SomeUnit::Int32Array)array_class )
{
var SomeUnit::Int32Array obj = new SomeUnit::Int32Array;
trace obj.arr;
}
// Trying to create an object of the StringArray class?
else if ((SomeUnit::StringArray)array_class )
{
var SomeUnit::StringArray obj = new SomeUnit::StringArray;
trace obj.arr;
}
else if ( ... )
...
I hope it helps you further.
Paul Banach