In c++ if I have a function that takes a class I have defined elsewhere as a parameter like so:
void moveto(CPoint2D point) { ... }
I can invoke it and pass along data to it like this:
moveto(CPoint2D(0,0));
basically creating the object and invoking it’s constructor to be passed to the function
Is there an equivalent to this in AS3?
if I have a function like this:
function initialize(min:Point, max:Point): void { ... }
how do I do something along the lines of :
initialize(Point(0,0), Point(10,10))
This throws an error im assuming because it thinks I want to cast something to a point and the notation I found earlier to do something similar only seemed to work if using the basic Object class. Any help on this would be greatly appreciated!
You make new objects (not classes) using
new:To pass anonymously-created objects (i.e. skip the variables), you pass in the entire
newexpressions directly as arguments, like this: