Yves Riel 写道:
> An interface is basically a contract between two classes. In the example
> below, the class containing the mentioned line doesn't care which class
> is passed to it from the _textFlow.interactionManager property, it just
> makes sure that it implements the interface (i.e. the contract). So,
> _textFlow.interactionManager probably returns an untyped Object and the
> command IEditManager() casts it so the compiler doesn't throw an error
> when the method applyParagraphFormat() is called.
>
> In other word, if the IEditManager() command was to be removed, the
> compiler would have choked out since _textFlow.interactionManager
> returns an Object and that applyParagraphFormat() is not a method
> belonging to a standard Object.
>
> Interface allows for polymorphism and is a very powerful tool in any OOP
> programmer tool belt. You definitely need to read up on it and
> understand it. You can find good tutorials on-line or just read the
> Programming AS3 section in the help.
>
> ________________________________
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of foodyi
> Sent: Monday, May 25, 2009 2:12 AM
> To: [email protected]
> Subject: [flexcoders] as3 interface syntax ?
>
>
>
>
>
> hi,all
> i read adobe textlayout framwork's sample code , i don't understand the
> code below:
>
> IEditManager(_textFlow.interactionManager).applyParagraphFormat(pf);
>
> thanks for your reply.
>
> foodyi
>
>
>
>
>
thanks for your detailed answer,i focus on the syntax of the interface
and neglected type conversion.