Skip to content

Instantly share code, notes, and snippets.

@Stray
Created October 21, 2010 12:47
Show Gist options
  • Save Stray/638414 to your computer and use it in GitHub Desktop.
Save Stray/638414 to your computer and use it in GitHub Desktop.
I had hoped that the compiler/AVM might be able to infer that the interface is valid.
public interface ICompoundInterface extends IDrawable, IEdible
{
}
public class SomethingConcrete implements IDrawable, IEdible
{
}
// throws type conversion error
var concreteThing:ICompoundInterface = ICompoundInterface(new SomethingConcrete());
// no error but concreteThing is null
var concreteThing:ICompoundInterface = new SomethingConcrete() as ICompoundInterface;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment