Also, mind this:

var a:*;
trace(a);
// undefined

var b:Object;
trace(b);
// null

An Object can't be undefined.

Cheers,
Claus.

Ian Thomas wrote:

'*' means "discard type checking"
'Object' means 'treat it as type Object'

If you have functions:

public function getThing():*
{
  return new Bucket();
}

public function getAnotherThing():Object
{
  return new Bucket();
}

then this will compile:

var someVar:Bucket=getThing();  // Ignores type checking

And this won't:

var someVar:Bucket=getAnotherThing();   // Tries to assign Object to
Bucket. Compile-time error.

(while this will - with a cast:

var someVar:Bucket=getAnotherThing() as Bucket;

)

HTH,
   Ian

On Fri, Aug 8, 2008 at 11:07 PM, Dave Segal <[EMAIL PROTECTED]> wrote:
What is the difference between typing an instance as "*" and typing it as
"Object"?


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to